libowfat/socket/socket_accept4.c

20 lines
463 B
C
Raw Normal View History

#ifndef __MINGW32__
2001-10-15 14:34:02 +00:00
#include <sys/types.h>
2001-02-05 18:25:24 +00:00
#include <sys/socket.h>
#include <netinet/in.h>
#endif
#include "windoze.h"
2001-02-05 18:25:24 +00:00
#include "socket.h"
2001-11-24 20:18:37 +00:00
#include "havesl.h"
2001-02-05 18:25:24 +00:00
int socket_accept4(int s,char *ip,uint16 *port) {
struct sockaddr_in si;
2001-11-24 20:18:37 +00:00
socklen_t len = sizeof si;
2001-02-05 18:25:24 +00:00
int fd;
if ((fd=accept(s,(struct sockaddr*) &si,&len))==-1)
return winsock2errno(-1);
2001-02-05 18:25:24 +00:00
*(uint32*)ip = *(uint32*)&si.sin_addr;
uint16_unpack_big((char *) &si.sin_port,port);
return fd;
}