• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how to tell a socket to use a specific interface...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to tell a socket to use a specific interface...


  • Subject: Re: how to tell a socket to use a specific interface...
  • From: Igor Garnov <email@hidden>
  • Date: Sun, 22 May 2005 22:22:48 +0400

Hello everybody

Perhaps you need to spend some time with a book like W. Richard Stevens' "Unix Network Programming, v1, 2ed (or 3ed)". First, what do you mean "code ... gets autorouted"? Second, bind() has *no* effect on routing. Routing is dictated by the destination address of the packet you want to be sent.

The comment may be old, but just in case: you *can't* bind to an interface.

But then could somebody imagine a situation when calling 'bind' before 'connect' makes some sense? I'm asking because I thought that if I call 'bind' before 'connect'ing, the outgoing packets will have the IP address in their headers, to which I have 'bound' the socket. If I don't 'bind' the socket that I'll use to connect to a server, the kernel will automatically 'bind' this socket for me.


So, in my opinion 'bind'ing a socket before 'connect'ing it to a remote server is only worth it when the remote server has some kind of restriction on the address of incoming connections. Then if I don't 'bind' the socket to the IP address which I know is trustworthy from the server's point of view, my kernel may bind this socket to another IP, and the remote server will refuse the connection.

Could someone comment on this?

Regards,
Igor

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: how to tell a socket to use a specific interface...
      • From: Justin Walker <email@hidden>
References: 
 >how to tell a socket to use a specific interface... (From: Philip George <email@hidden>)
 >Re: how to tell a socket to use a specific interface... (From: "Peter Lovell" <email@hidden>)
 >Re: how to tell a socket to use a specific interface... (From: Philip George <email@hidden>)
 >Re: how to tell a socket to use a specific interface... (From: Josh Graessley <email@hidden>)
 >Re: how to tell a socket to use a specific interface... (From: Philip George <email@hidden>)
 >Re: how to tell a socket to use a specific interface... (From: Justin Walker <email@hidden>)
 >Re: how to tell a socket to use a specific interface... (From: Philip George <email@hidden>)
 >Re: how to tell a socket to use a specific interface... (From: Justin Walker <email@hidden>)

  • Prev by Date: Problem with ssh under 10.4.1
  • Next by Date: Re: how to tell a socket to use a specific interface...
  • Previous by thread: Re: how to tell a socket to use a specific interface...
  • Next by thread: Re: how to tell a socket to use a specific interface...
  • Index(es):
    • Date
    • Thread