473,382 Members | 1,545 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,382 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 2168
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...
1
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.