Afficher un message
Vieux 02/05/2006, 14h48   #1
antred
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut [Socket API] Create local server socket without specifying a set port number?

Hi all,

I need to emulate the socketpair() function on a platform that doesn't
provide this function natively. I intend to achieve this by creating a
local server socket, then connecting to it via another socket and
finally accepting the incoming connection attempt. This would give me a
pair of connected sockets, just like the socketpair() function.
Now the question I have is this. In order to be able to connect() to my
server socket, I first need to bind() it to a set port number and then
specify that port number in my connect() call. But since both the
server socket and the connecting socket exist on the same computer (and
even in the same process) it isn't really necessary to have some "well
known" port number (and run the risk of that port number already being
occupied by some other application). So .... is there are way to let
the system assign an arbitrary port number to my server socket and then
calling some function to find out about that port number so I can
specify in my connect() call?
Thanks in advance for any useful replies!

Regards,

Markus

  Réponse avec citation
 
Page generated in 0,05547 seconds with 9 queries