home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / vmsnet / networks / tcpip / wintcp / 283 < prev    next >
Encoding:
Text File  |  1992-12-17  |  3.3 KB  |  85 lines

  1. Newsgroups: vmsnet.networks.tcp-ip.wintcp
  2. Path: sparky!uunet!eco.twg.com!eco.twg.com!larry
  3. From: larry@eco.twg.com (Lawrence B. Henry III)
  4. Subject: Re: porting Unix code to Wollongong
  5. Message-ID: <1992Dec17.160019.12647@eco.twg.com>
  6. Lines: 70
  7. Sender: larry@vishnu.eco.twg.com (Lawrence B. Henry III)
  8. Nntp-Posting-Host: eco.twg.com
  9. Reply-To: larry@eco.twg.com
  10. Organization: The Wollongong Group (East Coast Operations)
  11. References:  <1gocceINN124@pith.uoregon.edu>
  12. Date: Thu, 17 Dec 92 16:00:19 GMT
  13. Lines: 70
  14.  
  15.  
  16. In article <1gocceINN124@pith.uoregon.edu>, jqj@duff.uoregon.edu (JQ
  17. Johnson) writes:
  18. |>Path:
  19. |
  20. eco.twg.com!uunet!usc!rpi!usenet.coe.montana.edu!news.u.washington.edu!n
  21. news.uoregon.edu!duff.uoregon.edu!jqj
  22. |>From: jqj@duff.uoregon.edu (JQ Johnson)
  23. |>Newsgroups: vmsnet.networks.tcp-ip.wintcp
  24. |>Subject: porting Unix code to Wollongong
  25. |>Date: 16 Dec 1992 22:59:26 GMT
  26. |>Organization: University of Oregon Network Services
  27. |>Lines: 31
  28. |>Distribution: world
  29. |>Message-ID: <1gocceINN124@pith.uoregon.edu>
  30. |>NNTP-Posting-Host: duff.uoregon.edu
  31. |>
  32. |>I'm in the process of porting some moderately complex Unix networking
  33. |>code to Wollongong, and would like to solicit some advice from the
  34. |>community.  My problem is with netread(), netwrite(), and netclose().
  35. |>
  36. |>The code I'm working with makes the assumption that local fds
  37. |>(generated
  38. |>by VAXC open()) and remote sockets (generated by Wollongong socket())
  39. |>can be treated equivalently.  For instance, there are library
  40. |>routines that accept either and (sometimes after several levels of
  41. |>subroutine) call read() or write() to perform the I/O.  What's the
  42. |>best way to port such code?
  43. |>
  44. |>My options seem to be (1) to duplicate the library routines, and have
  45. |>the
  46. |>high level routines call the net- version of the library if
  47. |>appropriate,
  48. |>(2) [almost equivalent] add flag parameters or global variables to
  49. |>communicate whether a particular int refers to a VAXC fd or a TWG
  50. |>socket,
  51. |>or (3) to decide in the low level routine what a particular int refers
  52. |>to.
  53. |>What's my best bet?  
  54. |>
  55. |>In particular, is there any reliable way to distinguish between a fd
  56. |>and a
  57. |>socket?  I notice that VAXC, like most Unixes, returns small
  58. |>sequential
  59. |>ints for fds; Wollongong appears to return user memory addresses,
  60. |>e.g.
  61. |>280, 284, etc., so a gross check on value would appear to be
  62. |>possible.
  63. |>
  64. |>By the way, I have the same questions as the above for Multinet.  UCX
  65. |>presumably is not a problem in this regard.
  66. |>
  67. |>-- 
  68. |>JQ Johnson                Office: 250E Computing Center
  69. |>Director of Network Services        Internet: jqj@ns.uoregon.edu
  70. |>Computing Center, Univ. of Oregon    voice:    (503) 346-1746
  71. |>Eugene, OR  97403-1212            fax: (503) 346-4397
  72. |>
  73. JQ,
  74.     You might try one of two approaches.. the most clean approach is to
  75. get our UCX emulation and just use the C RTL.. This is coming out with our
  76. new release of PathWay for VMS... but given you don't want to wait for an
  77. upgrade you might want to try doing a MSG_PEEK QIO (IO$_RECEIVE) on a potential
  78. FD prior for every operation and if you receive the SS$_BADPARAM error.. assume that you 
  79. have a FD and use the C RTL otherwise assume that you have a socket 
  80. and follow those rules.. You will pay a performance penalty.. but it
  81. should give you a fairly simple port. ie, write your own read(), write() and
  82. close() functions which either call netread() or real read()..
  83.  
  84. -Larry.
  85.