home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Libraries / iplow / ReadMe < prev   
Encoding:
Text File  |  1994-11-08  |  1.6 KB  |  75 lines  |  [TEXT/MPCC]

  1. IP
  2.  
  3. iplow.c and iplow.h are part of a socket-like network interface 
  4. I have been working on.  My goal is to port Sun Microsystems'
  5. RPC 4.0 to the Macintosh. So far, so good.  The socket level
  6. calls are contained in a file named ip.c (and ip.h), which I have
  7. not included in this archive.
  8.  
  9.  
  10. UDP WARNING:
  11.  
  12. The UDP stuff is mostly untested. Use at your own risk!
  13.  
  14.  
  15. ADDENDUM:
  16.  
  17. To make a "WDS" for the TCP write call, try the following:
  18.  
  19. struct wdsEntry myWDS[2];    /* global write data structure */
  20.  
  21. myWDS[0].length = len;
  22. myWDS[0].ptr = data;
  23.  
  24. err = LowTCPSend(streams[sock].stream, (char)30, (Ptr)myWDS);
  25.  
  26. I'm trying the following for UDP, I've seen it work, but i'm not
  27. sure it's the best way:
  28.  
  29. int len, lenidx=0;
  30.  
  31. if (mtu == 0) {
  32.     err = LowUDPMTU(streams[sock].stream, streams[sock].remoteHost,
  33.                                              &mtu);
  34.     if (err != noErr) {
  35.         mtu = 0;
  36.         gMacErrno = err;
  37.         return -1;
  38.     }
  39. }
  40.  
  41. while (lenidx < len) {
  42.     myWDS[0].length = (mtu < (len - lenidx) ? mtu : (len - lenidx));
  43.     myWDS[0].ptr = &data[lenidx];
  44.     lenidx += myWDS[0].length;
  45.     
  46.     err = LowUDPWrite(streams[sock].stream, (Ptr)myWDS, streams[sock].remoteHost,
  47.                       streams[sock].remotePort);
  48.     if (err != noErr) {
  49.         gErrno = 0;
  50.         gMacErrno = err;
  51.         return -1;
  52.     }
  53. }
  54.  
  55. Again, I'm not sure if the above works well.... hopefully someone will
  56. come along and straighten me out.
  57.  
  58.  
  59. LEGAL STUFF
  60.  
  61. This code is free. If it breaks, I'm not resposible. Use at your own risk. 
  62.  
  63.  
  64. FINAL STUFF
  65.  
  66. I'd appreciate a note of thanks if you think this is useful.
  67.  
  68. Please email comments, suggestions, bug reports, general chat to
  69. trentmd@stu.beloit.edu (soon to change).
  70.  
  71. Thanks much, enjoy!
  72.  
  73. Mike Trent
  74. trentmd@stu.beloit.edu
  75. http://stu.beloit.edu/~trentmd/