[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

[Re:] Re: programming with interfaces

Hash: SHA1
    i am just wondering whether this is a more generic way of 
doing this. please comment on this - am i thinking in the right 
direction ????
For doing this, i am assuming these:
1. You have both the client and the server
2. You have programmed atleast one of them, and any changes 
you are doing, you are (obviously) doing in this.
Assuming you are programming client:
Execute the server in a system which can be reached only through 
the interface you want the packets to go through.
In the client:
1. Create a socket
2. Bind it (optionally) with INADDR_ANY
3. When you issue a connect to the server, the IP sub-system 
will automatically
select the interface you want to reach the server. this will 
_not_ happen only if your routing tables are not yet fully configured, 
and, hence, IP is forced to
use a default gateway, which happens to be in a different interface.
If you are programming the server:
The only thing that you have to do is to run your client in 
a system that can be reached only through the interface that 
you want. obviously the above restrictions apply.
These are very easy to do, if you are in a seperate subnet (which 
most probably
is not in your case :o)
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: Get my public key from http://arvind.freipsec.org
-----END PGP SIGNATURE-----                                 

On Wed, 20 Dec 2000 19:34:28 +0530 (IST)
Sreeji K Das wrote:

>While binding the socket, specify the address of the required 
>ie. if you want to use eth0, then:
>create socket (Use socket() system call)
>bind (Use the IP address of eth0)
>connect to the server (using connect())
>If you're new to sockets, try 'man 7 socket' & man 2 socket, 
man connect,
>man listen ....etc.
>On Wed, 20 Dec 2000, senthil devan wrote:
>> Hi
>> My comp has two ethernet cards (eth0,eth1). I have configured 
GRE interface
>> also(gre0).  Now I want to send datagram packets over the 
interface of my
>> choice. I want to do it in a program. Any help will be appreciated
>> Regards,
>> Devan
>> ---------------------------------------------
>> Find out more about this and other Linux India
>> mailing lists at http://lists.linux-india.org/
>LIP is all for free speech.  But it was created
>for a purpose.  Violations of the rules of
>this list will result in stern action.

Global Internet phone calls, voicemail, fax, e-mail and instant messaging.
Sign-up today for FREE account at http://www.hotvoice.com