本文整理汇总了C++中TCPSocket::onAccept方法的典型用法代码示例。如果您正苦于以下问题:C++ TCPSocket::onAccept方法的具体用法?C++ TCPSocket::onAccept怎么用?C++ TCPSocket::onAccept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPSocket
的用法示例。
在下文中一共展示了TCPSocket::onAccept方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connect
void TCPStream::connect(TCPSocket &tcpip)
{
tpport_t port;
endStream();
family = IPV4;
so = accept(tcpip.getSocket(), NULL, NULL);
if(so == INVALID_SOCKET)
return;
IPV4Host host = getPeer(&port);
if(!tcpip.onAccept(host, port)) {
endSocket();
iostream::clear(ios::failbit | rdstate());
return;
}
segmentBuffering(tcpip.getSegmentSize());
Socket::state = CONNECTED;
}
示例2: streambuf
TCPStream::TCPStream(TCPSocket &server, bool throwflag, timeout_t to) :
streambuf(), Socket(accept(server.getSocket(), NULL, NULL))
,iostream((streambuf *)this)
,bufsize(0)
,gbuf(NULL)
,pbuf(NULL) {
tpport_t port;
family = IPV4;
timeout = to;
setError(throwflag);
IPV4Host host = getPeer(&port);
if(!server.onAccept(host, port)) {
endSocket();
error(errConnectRejected);
iostream::clear(ios::failbit | rdstate());
return;
}
segmentBuffering(server.getSegmentSize());
Socket::state = CONNECTED;
}