return 0;
}
+#ifdef SUPPORTIPV6
+ if (!LHNETADDRESS_Resolve(&peeraddress, addr, 6667))
+ {
+ Con_Printf("[IRC] Bad server address: %s.\n", addr);
+ return 0;
+ }
+#else
if (!LHNETADDRESS_FromString(&peeraddress, addr, 6667))
{
Con_Printf("[IRC] Bad server address: %s.\n", addr);
return 0;
}
+#endif
// this should really be non-blocking, but it does not work.
- if(!(irc_socket = LHNET_OpenSocket(&address, &peeraddress, 1, 1, 0)))
+ if(!(irc_socket = LHNET_OpenSocket(&address, &peeraddress, 1, 0, 0)))
{
Con_Printf("[IRC] Failed to open a socket.\n");
return 0;
#else
char _true = 1;
#endif
- if (ioctlsocket(lhnetsocket->inetsocket, FIONBIO, use_blocking ? &_false : &_true) != -1)
+ if (1)
+ // if (ioctlsocket(lhnetsocket->inetsocket, FIONBIO, use_blocking ? &_false : &_true) != -1)
#endif
{
#ifdef IPV6_V6ONLY
{
if (LHNETSOCKET_TryConnect(lhnetsocket, peeraddress) != -1)
{
- int i = 1;
- // enable broadcast on this socket
- setsockopt(lhnetsocket->inetsocket, SOL_SOCKET, SO_BROADCAST, (char *)&i, sizeof(i));
-#ifdef IP_TOS
- {
- // enable DSCP for ToS support
- int tos = lhnet_default_dscp << 2;
- setsockopt(lhnetsocket->inetsocket, IPPROTO_IP, IP_TOS, (char *) &tos, sizeof(tos));
- }
+#ifdef MSG_DONTWAIT
+ if (1)
+#else
+ if (ioctlsocket(lhnetsocket->inetsocket, FIONBIO, use_blocking ? &_false : &_true) != -1)
#endif
- lhnetsocket->next = &lhnet_socketlist;
- lhnetsocket->prev = lhnetsocket->next->prev;
- lhnetsocket->next->prev = lhnetsocket;
- lhnetsocket->prev->next = lhnetsocket;
+ {
+ int i = 1;
+ // enable broadcast on this socket
+ setsockopt(lhnetsocket->inetsocket, SOL_SOCKET, SO_BROADCAST, (char *)&i, sizeof(i));
+#ifdef IP_TOS
+ {
+ // enable DSCP for ToS support
+ int tos = lhnet_default_dscp << 2;
+ setsockopt(lhnetsocket->inetsocket, IPPROTO_IP, IP_TOS, (char *) &tos, sizeof(tos));
+ }
+#endif
+ lhnetsocket->next = &lhnet_socketlist;
+ lhnetsocket->prev = lhnetsocket->next->prev;
+ lhnetsocket->next->prev = lhnetsocket;
+ lhnetsocket->prev->next = lhnetsocket;
#ifdef WIN32
- if (ioctlsocket(lhnetsocket->inetsocket, SIO_UDP_CONNRESET, &_false) == -1)
- Con_DPrintf("LHNET_OpenSocket_Connectionless: ioctlsocket SIO_UDP_CONNRESET returned error: %s\n", LHNETPRIVATE_StrError());
+ if (ioctlsocket(lhnetsocket->inetsocket, SIO_UDP_CONNRESET, &_false) == -1)
+ Con_DPrintf("LHNET_OpenSocket_Connectionless: ioctlsocket SIO_UDP_CONNRESET returned error: %s\n", LHNETPRIVATE_StrError());
#endif
- return lhnetsocket;
+ return lhnetsocket;
+ }
+ else
+ Con_Printf("LHNET_OpenSocket_Connectionless: ioctlsocket returned error: %s\n", LHNETPRIVATE_StrError());
}
else
{