Re: Binding to an IP but using anonymous ports

2007-07-29 Thread Gilad Ben-Yossef
Shachar Shemesh wrote: Gilad Ben-Yossef wrote: What BINDTODEVICE does is force the routing code to consider only routes that go through the requested interface. But what does it do when it sees "eth0:1"? It means the the specific IP address is labeled with the string "eth0:1". ifconfig onl

Re: Binding to an IP but using anonymous ports

2007-07-29 Thread Shachar Shemesh
Gilad Ben-Yossef wrote: > > > What BINDTODEVICE does is force the routing code to consider only > routes that go > through the requested interface. But what does it do when it sees "eth0:1"? On an amusing OT: if you involve vlans and virtual interfaces, you may end up with the interface name being

Re: Binding to an IP but using anonymous ports

2007-07-29 Thread Gilad Ben-Yossef
Shachar Shemesh wrote: It gets slightly more complicated than that. I need it cross platform :-). Searching http://msdn2.microsoft.com for "BINDTODEVICE" returns no results (well, none that seem relevant, anyways). Even if it did, I'm not sure how you specify the device's name in Windows, being

Re: Binding to an IP but using anonymous ports

2007-07-29 Thread Shachar Shemesh
guy keren wrote: > > the only question regarding what you found, is whether this is a > supported feature, or a "bug", that might get "fixed" in a later > version of the kernel.if it's a feture, it surely is simple enough to > use. note that unlike you, i didn't test my method, so currently > shach

Re: Binding to an IP but using anonymous ports

2007-07-29 Thread Amos Shapira
On 29/07/07, guy keren <[EMAIL PROTECTED]> wrote: > > i sent my mail before i saw yours, or i wouldn't have bothered ;) I got my mail out later than you because I was busy writing a program to test it. And it's good you sent it so I know about this option (of binding to a device) now. the only q

Re: Binding to an IP but using anonymous ports

2007-07-29 Thread guy keren
Amos Shapira wrote: On 29/07/07, *Gilad Ben-Yossef* <[EMAIL PROTECTED] > wrote: guy keren wrote: > here is something interesting: man 7 socket >and look for 'SO_BINDTODEVICE' You might find the following example useful

Re: Binding to an IP but using anonymous ports

2007-07-29 Thread Amos Shapira
On 29/07/07, Gilad Ben-Yossef <[EMAIL PROTECTED]> wrote: > > guy keren wrote: > > 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 What's

Re: Binding to an IP but using anonymous ports

2007-07-28 Thread Gilad Ben-Yossef
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

Re: Binding to an IP but using anonymous ports

2007-07-27 Thread Amos Shapira
On 27/07/07, Shachar Shemesh <[EMAIL PROTECTED]> 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? In the sockaddr_in struct you pass to bind(2), specify the IP address you want and leave t

Re: Binding to an IP but using anonymous ports

2007-07-27 Thread guy keren
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

Binding to an IP but using anonymous ports

2007-07-27 Thread Shachar Shemesh
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 - le