home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / vmsnet / networks / tcpip / multinet / 2565 < prev    next >
Encoding:
Internet Message Format  |  1992-12-18  |  2.0 KB

  1. Path: sparky!uunet!cs.utexas.edu!usc!news.service.uci.edu!unogate!mvb.saic.com!info-multinet
  2. From: adelman@TGV.COM (Kenneth Adelman)
  3. Newsgroups: vmsnet.networks.tcp-ip.multinet
  4. Subject: Re: porting Unix code to Multinet
  5. Message-ID: <921217161816.42400128@TGV.COM>
  6. Date: Thu, 17 Dec 92 16:19:59 PST
  7. Organization: Info-Multinet<==>Vmsnet.Networks.Tcp-Ip.Multinet Gateway
  8. X-Gateway-Source-Info: Mailing List
  9. Lines: 32
  10.  
  11. > I'm in the process of porting some moderately complex Unix networking
  12. > code to Multinet and would like to solicit some advice from the
  13. > community.  My problem is with socket_*().
  14.  
  15. > The code I'm working with makes the assumption that local fds (generated
  16. > by VAXC open()) and remote sockets (generated by Multinet socket()) can be
  17. > treated equivalently.  For instance, there are library routines that
  18. > accept either and (sometimes after several levels of subroutine) call
  19. > read() or write() to perform the I/O.  What's the best way to port such
  20. > code?  One approach is presumably to use the UCX emulation, where read(),
  21. > close(), and write() all take either sockets or fds.    Is there any
  22. > downside to that?
  23.  
  24. > My options seem to be (0) to use the UCX emulation, (1) to duplicate the
  25. > library routines, and have the high level routines call the net- version
  26. > of the library if appropriate, (2) [almost equivalent] to add flag
  27. > parameters or global variables to communicate whether a particular int
  28. > refers to a VAXC fd or a TGV socket, or (3) to decide in the low level
  29. > routine what a particular int refers to (in Wollongong code, I can use
  30. > the kludge that fds are sequentially assigned and so are very small ints,
  31. > whereas sockets are >= 192).    What's my best bet?
  32.  
  33.     I'd go with a variant of (2). They are all practical solutions, which
  34. is best depends on the complexity of the code and how willing you
  35. are to modify it.
  36.  
  37.     You could, instead of passing around "fds", pass around pointers
  38. to your own structure which contains the real fd and the type of fd.
  39. The library routines can examine the flag and know which routines to
  40. expect.
  41.  
  42.                             Ken
  43.