On Fri, 20 Nov 1998, klein fabien wrote:
> if(bind(Socket,&Destination,sizeof(Destination))==-1)
> {
> perror("bind");
> exit(1)
> }
You can't bind to destinations. That is known as connecting. The purpose of
bind() is to associated a socket with a well-known listening port possibly with
a restriction as to what networks are listened on. The most usual case is to
bind to the address 0.0.0.0, known as the wildcard address which causes your
port to listen on all attached networks. You can't bind to an address that does
not belong to yoru local machine.
Only server sockets need to undergo bind(). Client sockets can be used without
bind()---the system chooses a port number for them; the port number is then
known as ``ephemeral'' rather than ``well known''.
UDP sockets can be ``connected'' to peers using the connect() call. UDP is
connectionless; the meaning of connect() is simply to record, within the local
kernel, a destination for the socket so that you can use send() instead of
sendto(). It's a convenience that is primarily useful for clients.
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]