SocketPort::SocketPort(SocketService *svc, TCPV6Socket &tcp) : Socket(accept(tcp.getSocket(), NULL, NULL)) { detect_pending = true; detect_output = false; detect_disconnect = true; #ifdef WIN32 // FIXME: error handling event = CreateEvent(NULL,TRUE,FALSE,NULL); #endif next = prev = NULL; service = NULL; // FIXME: use macro here and in other files... #ifndef WIN32 if(so > -1) #else if(so != INVALID_SOCKET) #endif { setError(false); if( svc ) svc->attach(this); } }
void TCPStream::connect(TCPV6Socket &tcpip) { tpport_t port; endStream(); family = IPV6; so = accept(tcpip.getSocket(), NULL, NULL); if(so == INVALID_SOCKET) return; IPV6Host host = getIPV6Peer(&port); if(!tcpip.onAccept(host, port)) { endSocket(); iostream::clear(ios::failbit | rdstate()); return; } segmentBuffering(tcpip.getSegmentSize()); Socket::state = CONNECTED; }
TCPStream::TCPStream(TCPV6Socket &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 = IPV6; timeout = to; setError(throwflag); IPV6Host host = getIPV6Peer(&port); if(!server.onAccept(host, port)) { endSocket(); error(errConnectRejected); iostream::clear(ios::failbit | rdstate()); return; } segmentBuffering(server.getSegmentSize()); Socket::state = CONNECTED; }
SocketPort::SocketPort(SocketService *svc, TCPV6Socket &tcp) : Socket(accept(tcp.getSocket(), NULL, NULL)) { detect_pending = true; detect_output = false; detect_disconnect = true; next = prev = NULL; service = NULL; // FIXME: use macro here and in other files... if(so > -1) { setError(false); if( svc ) svc->attach(this); } }