#include #include #include #include #include "socket.h" #include "uint16.h" int socket_accept4(int s,char ip[4],u16 *port) { struct sockaddr_in sa; socklen_t dummy = sizeof sa; int fd; fd = accept(s,(struct sockaddr *) &sa,&dummy); if (fd == -1) return -1; memcpy(ip,(char *) &sa.sin_addr,4); u16_unpack_big((char *) &sa.sin_port,port); return fd; }