1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

Re: Windows port of your libwebsocket

The latest code changed need some win32 fixes:

Signed-off-by: Peter Hinz <cerebusrc@gmail.com>
This commit is contained in:
Peter Hinz 2011-03-10 18:14:01 +00:00 committed by Andy Green
parent 7627af52a3
commit bb45a90037
2 changed files with 11 additions and 2 deletions

View file

@ -402,17 +402,22 @@ libwebsockets_get_peer_addresses(int fd, char *name, int name_len,
p = (unsigned char *)host1->h_addr_list[n++];
if (p == NULL)
continue;
if ((host1->h_addrtype != AF_INET) &&
(host1->h_addrtype != AF_LOCAL))
if ((host1->h_addrtype != AF_INET)
#ifdef AF_LOCAL
&& (host1->h_addrtype != AF_LOCAL)
#endif
)
continue;
if (host1->h_addrtype == AF_INET)
sprintf(ip, "%u.%u.%u.%u", p[0], p[1], p[2], p[3]);
#ifdef AF_LOCAL
else {
un = (struct sockaddr_un *)p;
strncpy(ip, un->sun_path, sizeof(ip) -1);
ip[sizeof(ip) - 1] = '\0';
}
#endif
p = NULL;
strncpy(rip, ip, rip_len);
rip[rip_len - 1] = '\0';

View file

@ -7,11 +7,15 @@
#define DEBUG 1
#endif
#pragma warning(disable : 4996)
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
#define MSG_NOSIGNAL 0
#define SHUT_RDWR SD_BOTH
#define SOL_TCP IPPROTO_TCP
#define random rand
#define usleep _sleep
#define poll WSAPoll