|
|
|
|
@ -44,10 +44,14 @@ int TCP::Listen(int port) {
|
|
|
|
|
struct addrinfo hints, *res, *rp;
|
|
|
|
|
|
|
|
|
|
if (sock > 0) Close();
|
|
|
|
|
|
|
|
|
|
// FIXME: solution to get both (IPV4 and IPV6) to work at the same time?
|
|
|
|
|
bzero (&hints, sizeof (struct addrinfo));
|
|
|
|
|
hints.ai_flags = AI_PASSIVE;
|
|
|
|
|
#if defined(_WIN32) || defined(_WIN64) || defined(__CYGWIN__)
|
|
|
|
|
hints.ai_family = AF_INET;
|
|
|
|
|
#else
|
|
|
|
|
hints.ai_family = AF_INET6;
|
|
|
|
|
#endif
|
|
|
|
|
hints.ai_socktype = SOCK_STREAM;
|
|
|
|
|
if ((err = getaddrinfo (NULL, itoa(buffer, port, 32), &hints, &res)) != 0) {
|
|
|
|
|
return 0;
|
|
|
|
|
|