guy keren wrote:
Shachar Shemesh wrote:

Hi all,

Is it possible to conduct initiated TCP communication while binding to a
certain IP address, but still use the anonymous port range?

At the moment, I know of two modes of work:
1. Bind to a specific port, whether on a specific IP the machine has or
all IPs (IPADDR_ANY)
2. Do not bind - let the machine automatically pick a random port for
you. The IP is determined by picking the interface closest to the
gateway determined by the routing table to be the one you will need to
use to connect.

What I'm looking for is to allocate an IP specifically for a certain
application's use. I want all communications generated by that
application to carry that IP, but other applications should use the
default IP the machine has. Is it possible?


here is something interesting: man 7 socket
                               and look for 'SO_BINDTODEVICE'

You might find the following example useful:

http://www.codefidence.com/src/bindtodevice.c

Gilad

--
Gilad Ben-Yossef <[EMAIL PROTECTED]>
Codefidence. A name you can trust(tm)
http://www.codefidence.com
Phone: +972.3.7515563 ext. 201  | Cellular: +972.52.8260388
SIP: [EMAIL PROTECTED]  | Fax: +972.3.7515503

        Lacking fins or tail
        the gefilte fish swims with
        great difficulty.

          -- A Jewish Haiku

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to