home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / tcpiptk / accxrecv / readme < prev    next >
Text File  |  1999-05-11  |  2KB  |  54 lines

  1. ACCEPT_AND_RECV
  2. ---------------
  3. The accept_and_recv() API function accepts a connection on a socket, receives
  4. the first message from the connected client, and returns the local and peer
  5. addresses.
  6. It accepts a new connection, receives the first block of data from the client
  7. and returns the local and remote addresses to the application.  The thread
  8. sleeping on accept_and_recv() wakes-up only after it gets the first data block
  9. from the client.
  10.  
  11. SAMPLES FOR ACCEPT_AND_RECV
  12. ---------------------------
  13.  
  14. There are two exes named
  15.  
  16. a) accept.exe   - TCP server application
  17. b) recv.exe     - TCP client application
  18.  
  19. for explaining the accept_and_recv. The server opens a socket to which
  20. it binds and then does a listen on that socket.  It starts the number of
  21. specified threads and does accept_and_recv on each of them.
  22. The client opens a socket, connects to the server and sends the data.
  23. As the timeout option is set(by using setsockopt), whenever the client
  24. connects but doesn't send any data, the server times out.
  25.  
  26. The server can be started  as follows -
  27.  
  28. accept [server port] [number of acceptex threads]
  29. where:
  30. a) [server port] - stands for the port number to which  the server is to be bound.
  31. b) [number of acceptex threads] - stands for the number of simultaneous threads
  32.    on which accept_and_recv is to be done.
  33.  
  34. The client can be started as follows -
  35.  
  36. recv [server port]
  37. where;
  38. a) [server port] - is the port on which the server is bound.
  39.  
  40. COMPILATION
  41. ------------
  42.  
  43. The source code for the server and the client are in the files
  44. by name -
  45.  
  46. 1) accept.c
  47. 2) recv.c
  48.  
  49. These can be compiled by using the makefile given and running
  50. the following command
  51.  
  52. nmake /a
  53.  
  54.