473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

tcpClient and binding on dual homed machine?

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
5 2166
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Tomer Ben-David | last post by:
Hi I have a big j2ee appliction that was so forth run on a single cpu machine. I have tested it on a dual cpu machine, its running much slower (about X3 times slower). I know that...
3
by: Daniel | last post by:
TcpClient close() method socket leak when i use TcpClient to open a connection, send data and close the TcpClient with myTcpClientInstance.Close(); it takes 60 seconds for the actual socket on...
5
by: Horst Walter | last post by:
What is wrong here? IPAddress ipAddress = IPAddress.Parse("10.10.20.1"); IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, this.port); this.tcpClient = new TcpClient(ipEndPoint); // PROBLEM HERE...
2
by: Stu | last post by:
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...
2
by: Dave Coate | last post by:
Hi, I am working on a client-server app. I can get two applications to talk to each other on the same machine using 127.0.0.1, but as soon as I try it using a computer name or actual IP address...
1
by: xtseeker | last post by:
We have a multi-threaded .NET application, the problem is that the previous programmer didn't care to have locks on the shared variables. Somehow the application doesn't end up in Locked state on a...
0
by: zhangke007 | last post by:
Hello, everyone, Currently, I have an simple serial communication application using the serialnet.dll tool from Franson company. What this application does is to read the data through the com...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.