tho%carcvax.uconn.csnet@csnet-relay.arpa (Tho Tran) (04/09/86)
q1. Is there a way to find out whether a port number is used before doing a "bind"? As of now, you can only find out either EADDRINUSE or EADDRNOTAVAIL when you do a bind or connect. q2. If the answer is no to the q1, is there a "better" and sure way to dynamically allocate port numbers by a known server so that two processes can establish a communication path with a minimum number of retrial? Any suggestions will be greatly appreciated. -tho tho%swevax.uconn.csnet@csnet-relay
lerner@isi-vaxa.arpa (Mitchell Lerner) (04/09/86)
Yes to q2. I once had to dynamicly allocate ports (service names) to servers that did uploading of large map files. I had the server get the next available port (service name) from a service name server and then free the name when it was done using it. There were only 16 service names in all for this, so the boundry conditions had to be handled by haveing the client retry later for a port. It was all quite simple, the only thing that took some thinking was the protocol between map server and service name server. I have the code lying around, so if you have any questions on this implementation, I can refresh my own memory, then be of more service.
creon@ames-nas.arpa (04/09/86)
The sun RPC and NFS systems (which live on top of 4.2bsd sockets, and many other systems) has just such a port server, I beleive. ----------