1 #ifndef __SOCKET_TCP_LISTEN_H__ 2 #define __SOCKET_TCP_LISTEN_H__ 6 #include "socket_tcp.h" 18 inline bool OpenForListen(
const Socket_Address & Inaddess,
int backlog_size = 1024);
21 inline bool GetIncomingConnection(SOCKET & newsession,
Socket_Address &address);
27 static void init_type() {
28 Socket_IP::init_type();
29 register_type(_type_handle,
"Socket_TCP_Listen",
30 Socket_IP::get_class_type());
33 return get_class_type();
35 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
48 _socket = DO_NEWTCP();
52 if (DO_BIND(_socket, &Inaddess.GetAddressInfo()) != 0) {
56 if (DO_LISTEN(_socket, backlog_size) != 0) {
66 inline bool Socket_TCP_Listen::GetIncomingConnection(SOCKET & newsession,
Socket_Address &address)
68 newsession = DO_ACCEPT(_socket, &address.GetAddressInfo());
69 if (newsession == BAD_SOCKET)
78 if(!GetIncomingConnection(sck,address))
85 #endif //__SOCKET_TCP_LISTEN_H__ Base functionality for a TCP connected socket This class is pretty useless by itself but it does hide...
Base functionality for a INET domain Socket this call should be the starting point for all other unix...
bool OpenForListen(const Socket_Address &Inaddess, int backlog_size=1024)
This function will initialize a listening Socket.
Base functionality for a TCP rendezvous socket.
void SetSocket(SOCKET ins)
Assigns an existing socket to this class.
A simple place to store and munipulate tcp and port address for communication layer.
bool SetReuseAddress(bool flag=true)
Informs a socket to reuse IP address as needed.
TypeHandle is the identifier used to differentiate C++ class types.