(svn r15922) -Codechange: unify the ways to listen on a socket

This commit is contained in:
rubidium
2009-04-03 01:24:52 +00:00
parent ba5aafb9bb
commit 632d74c6b1
6 changed files with 87 additions and 61 deletions

View File

@@ -52,8 +52,8 @@ public:
* @param ip the unresolved hostname
* @param port the port
*/
NetworkAddress(const char *hostname = NULL, uint16 port = 0) :
hostname(hostname == NULL ? NULL : strdup(hostname)),
NetworkAddress(const char *hostname = "0.0.0.0", uint16 port = 0) :
hostname(strdup(hostname)),
address_length(0)
{
memset(&this->address, 0, sizeof(this->address));
@@ -159,6 +159,14 @@ public:
* @return the connected socket or INVALID_SOCKET.
*/
SOCKET Connect();
/**
* Make the given socket listen.
* @param family the type of 'protocol' (IPv4, IPv6)
* @param socktype the type of socket (TCP, UDP, etc)
* @return the listening socket or INVALID_SOCKET.
*/
SOCKET Listen(int family, int socktype);
};
#endif /* ENABLE_NETWORK */