• 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: (correction) how to tell a socket to use a specific interface...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (correction) how to tell a socket to use a specific interface...


  • Subject: Re: (correction) how to tell a socket to use a specific interface...
  • From: anna Smith <email@hidden>
  • Date: Wed, 25 May 2005 12:24:54 +0530

Hi

Can any one help me out how to get the node addess and network address of the node.
in old code " Open ADSP socket " concept is used.
How i should do it .
Please do reply as soon as possible

Thanks
Anna


On 5/21/05, Philip George <email@hidden> wrote:
i had a typo in the code i sent.  correction below ('int drval = 1'
changed to 'int val = 1').

also, i didn't specify before that i'm talking about an outgoing
connection.  in other words, i use send() a few lines after what is
shown here to send a web request and recv() to get the requested page.
the catch being that i need to specify that the request be routed
through a specific interface, not just any old interface (assuming that
at runtime there are 2 or more available connections from the computer
out to the internet).


CORRECTED CODE SNIPPET:

// setup local address stuff...

struct sockaddr_in LOCaddr;
LOCaddr.sin_family = AF_INET;
LOCaddr.sin_addr.s_addr = inet_addr(local_ip);


// set to true for SO_DONTROUTE...

int val = 1;


// bind to specific interface and then set SO_DONTROUTE...

if (bind(sockethandle, (struct sockaddr *)&LOCaddr,
sizeof(LOCaddr))==0) {
        setsockopt(sockethandle, SOL_SOCKET, SO_DONTROUTE, &val, sizeof(val));
}




thanks again.

- philip


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

 _______________________________________________
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

References: 
 >how to tell a socket to use a specific interface... (From: Philip George <email@hidden>)
 >Re: (correction) how to tell a socket to use a specific interface... (From: Philip George <email@hidden>)

  • Prev by Date: Re: More Configd going "Us" / sample configd
  • Next by Date: Firewall settings
  • Previous by thread: Re: (correction) 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