upscheme/c/socket.h

22 lines
520 B
C
Raw Normal View History

#ifdef _WIN32
2008-06-30 21:53:51 -04:00
#include <winsock2.h>
#else
#include <netinet/in.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
2011-04-10 23:24:30 -04:00
#include <fcntl.h>
2008-06-30 21:53:51 -04:00
#endif
#ifndef _WIN32
void closesocket(int fd);
#endif
2008-06-30 21:53:51 -04:00
int open_tcp_port(short portno);
int open_any_tcp_port(short *portno);
int open_any_udp_port(short *portno);
int connect_to_host(char *hostname, short portno);
int sendall(int sockfd, char *buffer, int bufLen, int flags);
int readall(int sockfd, char *buffer, int bufLen, int flags);
int socket_ready(int sock);