TCP Address Question

B

bob

Hi,
I have an ASP.net page that uses a dll to send a request via TCP
channel nnnn (TCPClient / XML Serialiser) to a Windows app.
The Windows app receives (TCPListener / TCPClient / XMLDeserialiser)
processes the request and sends back a response (TCPClient /
XMLSerialiser) via TCP channel yyyy back to the dll
(TCPListener/TCPClient/XMLDeserialiser).


Using the IIS on the development machine and having the windows app
running on the development machine it works fine.

I now want to move the web page across to the production server (Same
LAN)
I am unclear about what IPAddresses to set for the respective TCP
listeners and TCPclients

For the DLL I thought there would be no change because it is still
trying to send and listen to the development machine

For the app I thought I would need to put the local ip of the
webserver upon which the page & dll will be residing.
But when I try to run the app, at the Listener.start command, it
complains that the IP address is not valid in its context.

So I guess it comes down to my understanding (or lack there of) of
what the TCP components expect.

Do the Tx components (TcpClient/XMLSerialiser) expect the destination
address and the Rx components (TCPListener/TcpClient/XMLDeserialiser)
the local address?
or
Do they both expect the local address upon which they reside?
or
is my methodology flawed for what I am trying to achieve.
(Nooo I really don't want a quick to move to WCF if I can avoid it.
I know nothing about it.)
thanks
Bob
 
B

bob

[...]
For the DLL I thought there would be no change because it is still
trying to send and listen to the development machine

For the app I thought I would need to put the local ip of the
webserver upon which the page & dll will be residing.
But when I try to run the app, at the Listener.start command, it
complains that the IP address is not valid in its context.

You probably have those backwards. That is, you need to update the DLL to
use the correct address when it connects to the application listening for
requests (because relative to the DLL, the application's address may have
changed...though, this depends on what address you were using, and to
where you've relocated the DLL's execution), and the application should
not have to change at all (but in your case it might, if you have written
it incorrectly in the first place...see below).

Since you didn't post an actual concise-but-complete code example that
reliably demonstrates the problem, it's hard to say for sure what needs
fixing. But, of the "thing that should stay the same", and the "thing
that probably will change", you have them reversed.
So I guess it comes down to my understanding (or lack there of) of
what the TCP components expect.

Do the Tx components (TcpClient/XMLSerialiser) expect the destination
address and the Rx components (TCPListener/TcpClient/XMLDeserialiser)
the local address?

It is incorrect describe the endpoints as "Tx" or "Rx". TCP is (and other
network protocols are too) bidirectional.

You _may_ think of the "listener" (e.g. TcpListener) as the server, and
the "connector" as the client (TcpClient), but note that once a connection
has been established, "server" and "client" are really only describable in
terms of your higher-level protocol. The connection itself is essentially
peer-to-peer, even when one end is clearly a server and the other is
clearly a client (e.g. POP, SMTP, FTP, HTTP, etc.).

Now, with that in mind:

-- The "listener" specifies its own address when listening. Typically
this is the "any" address ("0.0.0.0"), represented by the IPAddress class
as "IPAddress.Any". You should specific an exact IP address only if there
is some very specific need to have that listener listen/receive only on a
specific network adapter installed on that computer. Note that the
address only affects the address others use to _send_ to the listener.
When the listener responds, the network driver will decide what the
appropriate network adapter to use is.

-- The "connector" specifies the _listener's_ address when attempting
to connect. This _must_ be a valid address of the listener, as the
_connector_ sees it. Note that this means that if the listener is behind
a proxy, a NAT router, a firewall, etc. the address that the connector
uses may or may not be the same as what the listener would see if it
inspected its own local network adapter's address. Note also that the
listener generally does not concern itself at all with what its "public"
address is. It simply uses the "any" address, and lets the OS and
hardware network components deal with the rest.

My best guess, given the relatively vague problem description, is that you
need to fix your TcpListener (the application) so that it's using
IPAddress.Any, and you possibly need to fix your TcpClient (the DLL) so
that it uses the correct IP address for the computer that the application
is running on.

Pete
Hi Pete,
thank you for your reply.
The crux was the IPAddress.Any
All working now.
Thanks again
Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top