New constructor for TCPListener

G

Guest

I use in vb (VS2005)

Server = New TcpListener(PortNumber)

Which is simple and straightforward. But I get
Public Sub New(port As Integer) is obsolete: This method has been
deprecated. Please use TcpListener(IPAddress localaddr, int port) instead.

It also gives a link that returns "page not found."

If I use the new constructor, what values do I give it so that it behaves
the same as the old constructor?
I guess the port number would be the same, but what in the world should I
put as the IPAddress?

The scenario is this: First I deploy the app as a service on my development
machine and put the TCP communications through its paces, from apps on my
machine and other machines.
Next I uninstall it from my machine and install it on a test server, and put
it through the same tests.
Finally, I uninstall it from the test server and install it on the
production server. etc.

This should all work without changing any code in the program or the
contents of any files it reads, and without recompiling the program.

I can do this with the "obsolete" constructor. What do I use for IPAddress
so it works the same way with the new constructor?
 
H

Henning Krause [MVP - Exchange]

Hello,

if you use IPAddress.Any, it will bind to all available addresses on the
machine.

Kind regards,
Henning Krause
 

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