Aquarius_Girl
Aquarius_Girl

Reputation: 22906

Understanding socket names

Socket names are strings and appear in the file system name space through portals.

from http://publib.boulder.ibm.com/infocenter/aix/v7r1/index.jsp?topic=%2Fcom.ibm.aix.progcomm%2Fdoc%2Fprogcomc%2Fskt_comms.htm

The bind call is used to assign a name to a socket on the local side of a connection.

from http://osr507doc.sco.com/en/netguide/dusockD.binding_names.html

int bind(int socket, const struct sockaddr *address, socklen_t address_len);

from the man page of bind.

What EXACTLY are the socket "names"? And do we "set" them?

The bind system call, doesn't seem to have an argument for specifying a name, does it?

Upvotes: 2

Views: 3528

Answers (1)

unNamed
unNamed

Reputation: 1019

It's common that the function which acturally opens the socket returns a handle/identifier(socket descriptor) for future references.
As the link you posted describes:

bind(s, name, namelen);

The argument s in the line above is the socket descriptor returned from the socket() call.

I think it's just a custom name for the socket descriptor, and therefore optional. Probably also depends on what you're about to do, if you need it.

Upvotes: 1

Related Questions