Boost logo

Boost Users :

Subject: [Boost-users] [Asio] Binding tcp socket to a particular network interface
From: De Sousa, Dan (Dan.DeSousa_at_[hidden])
Date: 2012-03-23 14:10:18


I'm trying to figure out the best cross platform solution to guarantee that a particular boost socket always binds to a particular network interface (eth0, eth4, etc).

I know how to resolve the interface to an address and I see that I can specify an tcp endpoint to tcp socket on construction or with bind, but I also need to specify the port.

Since I could be connecting to multiple servers in one instance, and have to deal with multiple instances of this library on the same machine, I can't rely a fixed port number.

So my question(s):

Is there a reliable cross platform way to get an endpoint to an address without a port?

Or to do what boost tcp socket does by default, to get an unbound port for an address?

Or generally guarantee that the socket is bound to a particular network interface?

Short of finding a way to resolve ports, I don't see a way to do this repeatedly. For some context, we are trying to eliminate routing tables to specify the interface to particular servers.

Thanks in advance for any suggestions!

Dan

________________________________

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net