2 * socket.h -- declarations for socket library functions
4 * Design and implementation by Carl Harris <ceharris@mal.com>
6 * For license terms, see the file COPYING in this directory.
13 #ifdef INADDR_BROADCAST
14 #define INADDR_NONE INADDR_BROADCAST
16 #define INADDR_NONE -1
20 #if defined(HAVE_PROTOTYPES)
22 Create a new client socket
25 int Socket(char *host, int clientPort);
28 Get a string terminated by an '\n', delete any '\r' and the '\n'.
29 Pass it a valid socket, a buffer for the string, and
30 the length of the buffer (including the trailing \0)
31 returns 0 for success.
33 int SockGets(int socket, char *buf, int len);
36 Send a nul terminated string to the socket, followed by
37 a CR-LF. Returns 0 for success.
39 int SockPuts(int socket, char *buf);
42 Write a chunk of bytes to the socket.
43 Returns 0 for success.
45 int SockWrite(int socket, char *buf, int len);
48 Read a chunk of bytes from the socket.
49 Returns 0 for success.
51 int SockRead(int socket, char *buf, int len);
54 Send formatted output to the socket, followed
56 Returns 0 for success.
58 #if defined(HAVE_STDARG_H)
59 int SockPrintf(int socket, char *format, ...) ;
64 Check socket for readability. return 0 for not readable,
67 int SockStatus(int socket, int seconds);
69 #endif /* defined(HAVE_PROTOTYPES) */