chenged udp_send .. recvfrom did hung even with select

origin
stpohle 16 years ago
parent 3e234b5d49
commit 94e90a2e10

@ -1,4 +1,4 @@
/* $Id: configuration.c,v 1.84 2009/05/11 20:51:25 stpohle Exp $
/* $Id: configuration.c,v 1.85 2009/11/28 13:11:51 stpohle Exp $
* configuration */
#include <SDL.h>
@ -591,6 +591,7 @@ config_video ()
{"640x480", NULL},
{"800x600", NULL},
{"1024x768", NULL},
{"1280x800", NULL},
{"1280x1024", NULL},
{"1600x1200", NULL},
{"1920x1080", NULL},

@ -1,4 +1,4 @@
/* $Id: udp.c,v 1.16 2009/05/12 20:50:34 stpohle Exp $ */
/* $Id: udp.c,v 1.17 2009/11/28 13:11:51 stpohle Exp $ */
/* udp.c code for the network
File Version 0.2
*/
@ -286,11 +286,9 @@ udp_get (int sock, char *text, int len, struct _sockaddr *sAddr, int ai_family)
tval.tv_sec = 0;
tval.tv_usec = 100;
msglen = 0;
if (select (sock + 1, &sockset, NULL, NULL, &tval)) {
msglen = recvfrom (sock, text, len, 0, (struct sockaddr *) sAddr, &clen);
if (select (sock + 1, &sockset, NULL, NULL, &tval)) if (FD_ISSET (sock, &sockset)) {
msglen = recvfrom (sock, text, len, MSG_DONTWAIT, (struct sockaddr *) sAddr, &clen);
if (msglen < 0)
return 0;
@ -307,10 +305,8 @@ dns_net_getip (char *host)
struct hostent *hAddr;
hAddr = gethostbyname (host);
if (hAddr == NULL)
return NULL;
strncpy (dnsip, inet_ntoa (*((struct in_addr *) hAddr->h_addr)), UDP_LEN_HOSTNAME);
return dnsip;

Loading…
Cancel
Save