home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / unix / wizards / 4562 < prev    next >
Encoding:
Internet Message Format  |  1992-11-08  |  1.4 KB

  1. Path: sparky!uunet!ogicse!emory!sol.ctr.columbia.edu!zaphod.mps.ohio-state.edu!rpi!cecchinr
  2. From: cecchinr@gehrig.cs.rpi.edu (Ron Cecchini)
  3. Newsgroups: comp.unix.wizards
  4. Subject: Q: Proper client/server protocol w.r.t. socket read/writes
  5. Message-ID: <0ck1+wp@rpi.edu>
  6. Date: 6 Nov 92 23:06:24 GMT
  7. Article-I.D.: rpi.0ck1+wp
  8. Organization: Rensselaer Polytechnic Institute, Troy, NY
  9. Lines: 24
  10. Nntp-Posting-Host: gehrig.cs.rpi.edu
  11.  
  12. Hi all - I figured it was ok to post this here, since it is a socket question.
  13.  
  14. Basically, I just want to know what is the proper protocol to use when
  15. I am simultaneously reading/writing from/to a socket.  I am looking at
  16. some client/server code that a friend wrote, and every time she does a
  17. write, she immediately does a read to acknowledge that the info got to 
  18. the other side - I'll draw a picture:
  19.  
  20. Client: Write "info"            Server: Read "info"
  21.                         Write "received info"
  22. Client: Read - if equals "received info" 
  23.                then do the next write
  24.                else error
  25.  
  26. You get the picture... My question is: is this the standard way of doing
  27. this?  It seems like you double the processing time by having to read
  28. for every write, and vice-versa.  She says that when she didn't do this,
  29. her application crashed because of some kind of "imbalance".
  30.  
  31. I just want to know if this is what I have to and, if not, then what is the
  32. right way.
  33.  
  34. Thanx a mil,
  35. Ron
  36.