home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / vmsnet / networks / tcpip / multinet / 2405 < prev    next >
Encoding:
Text File  |  1992-11-20  |  1.6 KB  |  35 lines

  1. X-Gateway-Source-Info: INTERNET
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!usc!news.service.uci.edu!unogate!mvb.saic.com!tgv.com!info-multinet
  3. Date: 20 NOV 92 21:05:10 GMT
  4. Newsgroups: vmsnet.networks.tcp-ip.multinet
  5. X-Return-path: <info-multinet-relay@TGV.COM>
  6. X-RFC822-From:     adelman (Kenneth Adelman) @ TGV.COM
  7. From: adelman@TGV.COM
  8. Subject:  Re: How can I get a free port number?
  9. Organization: The INFO-MULTINET Community
  10. Message-ID: <36A00FB320NOV92210510@TGV.COM>
  11. Nntp-Posting-Host: Mvb.Saic.Com
  12. Lines: 21
  13.  
  14. >     I am running Multinet 3.0 Rev. A.   I was wondering if anyone could help
  15. > me with the following problem.
  16.  
  17. >     I have a computer which is booted via TCP from a VMS VAX.   For reasons that
  18. > are long and boring, I must supply the remote computer with the number of
  19. > an unused TCP/IP port.   This port must not be in use, in any state, at
  20. > the time the computer boots.     Is there any call or combination of calls
  21. > that I could make to the Multinet subroutine library that would report to
  22. > me an unused, or free, port number?    Alternatively, I could just sequentially
  23. > try port numbers if I knew of a subroutine that would tell me if a port
  24. > was in use (it must not even be in a time-out or fin_wait state).   I'm
  25. > currently using a subroutine that examines the output of the
  26. > MULTINET SHOW/CONN command, and finds a free port by brute force, but
  27. > this is apt to win me few points for either elegance or efficiency.
  28.  
  29.     If you bind() to port 0 you'll get an unused port number assigned
  30. to you. You can discover it with getsockname() and then socket_close()
  31. the socket you bound to to free it.
  32.  
  33.                                 Ken
  34. 
  35.