home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-08 | 1.6 KB | 75 lines | [TEXT/MPCC] |
- IP
-
- iplow.c and iplow.h are part of a socket-like network interface
- I have been working on. My goal is to port Sun Microsystems'
- RPC 4.0 to the Macintosh. So far, so good. The socket level
- calls are contained in a file named ip.c (and ip.h), which I have
- not included in this archive.
-
-
- UDP WARNING:
-
- The UDP stuff is mostly untested. Use at your own risk!
-
-
- ADDENDUM:
-
- To make a "WDS" for the TCP write call, try the following:
-
- struct wdsEntry myWDS[2]; /* global write data structure */
-
- myWDS[0].length = len;
- myWDS[0].ptr = data;
-
- err = LowTCPSend(streams[sock].stream, (char)30, (Ptr)myWDS);
-
- I'm trying the following for UDP, I've seen it work, but i'm not
- sure it's the best way:
-
- int len, lenidx=0;
-
- if (mtu == 0) {
- err = LowUDPMTU(streams[sock].stream, streams[sock].remoteHost,
- &mtu);
- if (err != noErr) {
- mtu = 0;
- gMacErrno = err;
- return -1;
- }
- }
-
- while (lenidx < len) {
- myWDS[0].length = (mtu < (len - lenidx) ? mtu : (len - lenidx));
- myWDS[0].ptr = &data[lenidx];
- lenidx += myWDS[0].length;
-
- err = LowUDPWrite(streams[sock].stream, (Ptr)myWDS, streams[sock].remoteHost,
- streams[sock].remotePort);
- if (err != noErr) {
- gErrno = 0;
- gMacErrno = err;
- return -1;
- }
- }
-
- Again, I'm not sure if the above works well.... hopefully someone will
- come along and straighten me out.
-
-
- LEGAL STUFF
-
- This code is free. If it breaks, I'm not resposible. Use at your own risk.
-
-
- FINAL STUFF
-
- I'd appreciate a note of thanks if you think this is useful.
-
- Please email comments, suggestions, bug reports, general chat to
- trentmd@stu.beloit.edu (soon to change).
-
- Thanks much, enjoy!
-
- Mike Trent
- trentmd@stu.beloit.edu
- http://stu.beloit.edu/~trentmd/