home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / N / TCPIP / POPCLIEN.000 / POPCLIEN / pop / socket.h < prev   
Encoding:
C/C++ Source or Header  |  1994-04-01  |  1.6 KB  |  72 lines

  1.  
  2. /***********************************************************************
  3.   module:       socket.h
  4.   program:      popclient
  5.   SCCS ID:    @(#)socket.h    1.5  4/1/94
  6.   programmer:   Carl Harris, ceharris@vt.edu
  7.   compiler:     DEC RISC C compiler (Ultrix 4.1)
  8.   environment:  DEC Ultrix 4.3 
  9.   description:  Definitions module for socket.c
  10.  ***********************************************************************/
  11.  
  12. #ifndef SOCKET__
  13. #define SOCKET__
  14.  
  15. #ifndef  INADDR_NONE
  16. #ifdef   INADDR_BROADCAST
  17. #define  INADDR_NONE    INADDR_BROADCAST
  18. #else
  19. #define     INADDR_NONE    -1
  20. #endif
  21. #endif
  22.  
  23. #ifndef NO_PROTO
  24. /*
  25. Create a new client socket 
  26. returns < 0 on error 
  27. */
  28. int Socket(char *host, int clientPort);
  29.  
  30. /* 
  31. Get a string terminated by an '\n', delete any '\r' and the '\n'.
  32. Pass it a valid socket, a buffer for the string, and
  33. the length of the buffer (including the trailing \0)
  34. returns 0 for success. 
  35. */
  36. int SockGets(int socket, char *buf, int len);
  37.  
  38. /*
  39. Send a nul terminated string to the socket, followed by 
  40. a CR-LF.  Returns 0 for success.
  41. */
  42. int SockPuts(int socket, char *buf);
  43.  
  44. /*
  45. Write a chunk of bytes to the socket.
  46. Returns 0 for success.
  47. */
  48. int SockWrite(int socket, char *buf, int len);
  49.  
  50. /*
  51. Read a chunk of bytes from the socket.
  52. Returns 0 for success.
  53. */
  54. int SockRead(int socket, char *buf, int len);
  55.  
  56. /* 
  57. Send formatted output to the socket, followed
  58. by a CR-LF.
  59. Returns 0 for success.
  60. */
  61. int SockPrintf();
  62.  
  63. /*
  64. Check socket for readability.  return 0 for not readable,
  65. >0 for readable.
  66. */
  67. int SockStatus(int socket, int seconds);
  68.  
  69. #endif /* #ifndef NO_PROTO */
  70.  
  71. #endif /* SOCKET__ */
  72.