By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,558 Members | 1,603 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,558 IT Pros & Developers. It's quick & easy.

tcpClient and binding on dual homed machine?

P: n/a
Stu
I'm using tcpClient to send data to a pocket pc from the server. The server
is dual homed and tcpClient seems to bind to the first address
(.AddressList(0)) - how do I bind that to another address (.AddressList(1)).
I need to do this because the network adapter for eth0 is on non routable
network that can't talk to anything else (on purpose). This software will
run on many different servers, so I'll need the software to be able to pick
what IP it listens on and sends on.

I know this is probably a newbe questions, but neither of the books that I
have as reference or google has provided me with much of an answer.

Thanks In Advance,

Stu

Jul 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
what do you mean by "dual homed"?
"Stu" <St*@thynk.us> wrote in message
news:eO****************@TK2MSFTNGP10.phx.gbl...
I'm using tcpClient to send data to a pocket pc from the server. The server is dual homed and tcpClient seems to bind to the first address
(.AddressList(0)) - how do I bind that to another address (.AddressList(1)). I need to do this because the network adapter for eth0 is on non routable
network that can't talk to anything else (on purpose). This software will
run on many different servers, so I'll need the software to be able to pick what IP it listens on and sends on.

I know this is probably a newbe questions, but neither of the books that I
have as reference or google has provided me with much of an answer.

Thanks In Advance,

Stu

Jul 21 '05 #2

P: n/a
Stu
Has two network cards and talks to two seperate networks. Basically I'm
just trying to force the tcpclient to the network card of my choosing.
Should be a fairly simple task, but I'm stumped on how to get there.

Stu
"Brian Henry" <brianiup[remove-me]@adelphia.net> wrote in message
news:uP**************@TK2MSFTNGP11.phx.gbl...
what do you mean by "dual homed"?
"Stu" <St*@thynk.us> wrote in message
news:eO****************@TK2MSFTNGP10.phx.gbl...
I'm using tcpClient to send data to a pocket pc from the server. The

server
is dual homed and tcpClient seems to bind to the first address
(.AddressList(0)) - how do I bind that to another address

(.AddressList(1)).
I need to do this because the network adapter for eth0 is on non routable network that can't talk to anything else (on purpose). This software will run on many different servers, so I'll need the software to be able to

pick
what IP it listens on and sends on.

I know this is probably a newbe questions, but neither of the books that I have as reference or google has provided me with much of an answer.

Thanks In Advance,

Stu


Jul 21 '05 #3

P: n/a
I think you call bind, listen then accept to do sockets.
It looks like you need to specify which interface you want to use in the
bind call.
Here is a quote from MSDN Socket.Bind docs.

Before calling Bind, you must first create the local IPEndPoint from which
you intend to communicate data. If you do not care which local address is
assigned, you can create an IPEndPoint using IPAddress.Any as the address
parameter, and the underlying service provider will assign the most
appropriate network address. This might help simplify your application if
you have multiple network interfaces. If you do not care which local port is
used, you can create an IPEndPoint using 0 for the port number. In this
case, the service provider will assign an available port number between 1024
and 5000.
Jul 21 '05 #4

P: n/a
You can use the constructor which takes an IP address and port number to
bind your socket to a given adapter. That is, if your RAS IP address is
172.72.0.1 and your Ethernet IP is 172.73.0.1 and you want to use Ethernet
to make your connection to the server, you'd do something like:

xxx = new TcpClient( "172.73.0.1", clientPortNumber );

Paul T.
"Stu" <St*@thynk.us> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Has two network cards and talks to two seperate networks. Basically I'm
just trying to force the tcpclient to the network card of my choosing.
Should be a fairly simple task, but I'm stumped on how to get there.

Stu
"Brian Henry" <brianiup[remove-me]@adelphia.net> wrote in message
news:uP**************@TK2MSFTNGP11.phx.gbl...
what do you mean by "dual homed"?
"Stu" <St*@thynk.us> wrote in message
news:eO****************@TK2MSFTNGP10.phx.gbl...
I'm using tcpClient to send data to a pocket pc from the server. The server
is dual homed and tcpClient seems to bind to the first address
(.AddressList(0)) - how do I bind that to another address

(.AddressList(1)).
I need to do this because the network adapter for eth0 is on non routable network that can't talk to anything else (on purpose). This software will run on many different servers, so I'll need the software to be able to

pick
what IP it listens on and sends on.

I know this is probably a newbe questions, but neither of the books
that I have as reference or google has provided me with much of an answer.

Thanks In Advance,

Stu



Jul 21 '05 #5

P: n/a
Sorry, previous message showed the wrong constructor used. You want to use
the one which takes an IPEndPoint, passing the local IP you want to bind to
and the local port you want to bind to when you create the IPEndPoint
instance.

Paul T.

"Stu" <St*@thynk.us> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Has two network cards and talks to two seperate networks. Basically I'm
just trying to force the tcpclient to the network card of my choosing.
Should be a fairly simple task, but I'm stumped on how to get there.

Stu
"Brian Henry" <brianiup[remove-me]@adelphia.net> wrote in message
news:uP**************@TK2MSFTNGP11.phx.gbl...
what do you mean by "dual homed"?
"Stu" <St*@thynk.us> wrote in message
news:eO****************@TK2MSFTNGP10.phx.gbl...
I'm using tcpClient to send data to a pocket pc from the server. The server
is dual homed and tcpClient seems to bind to the first address
(.AddressList(0)) - how do I bind that to another address

(.AddressList(1)).
I need to do this because the network adapter for eth0 is on non routable network that can't talk to anything else (on purpose). This software will run on many different servers, so I'll need the software to be able to

pick
what IP it listens on and sends on.

I know this is probably a newbe questions, but neither of the books
that I have as reference or google has provided me with much of an answer.

Thanks In Advance,

Stu



Jul 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.