473,396 Members | 1,770 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,396 software developers and data experts.

New constructor for TCPListener

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?
Aug 15 '07 #1
2 3981
Hello,

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

Kind regards,
Henning Krause

"Jon Jacobs" <Jo*******@discussions.microsoft.comwrote in message
news:62**********************************@microsof t.com...
>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?
Aug 15 '07 #2
if you use IPAddress.Any, it will bind to all available addresses on the
machine.
Excellent. Thank you
Aug 15 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: zZ | last post by:
Hi All, I'm building a TCPListener as the server to accept TCPClient connections, using TCPListener.AcceptTcpClient. I'd like to retrieve client's IP after connected, but found no way to do...
4
by: byron guerrero | last post by:
I need to execute a TcpListener in a windows service. tanks for the help.
1
by: Doug Wyatt | last post by:
So I'll preface this with the fact that I'm a UNIX developer by training and have just recently gotten in to C# development on Windows. I'm basically running in to a problem whereby I suspect...
1
by: Reshma Prabhu | last post by:
Hello, I have created a client-server application using TcpListener and TcpClient. But the TcpListener stops listening after some amount of time if the client does not send any data. What is...
4
by: Rob White | last post by:
OK, so I have a TcpListener that is waiting for sockets, this piece of code: IPAddress localAddress = Dns.GetHostByName(Dns.GetHostName()).AddressList; IPEndPoint localEP = new...
3
by: Bjørn Eliasen | last post by:
Hi, I have an application running on all pc's in our company. Basically it is a TCPListener awaiting for sockets to connect and on connection performs the required tasks. The app works fine, but...
4
by: Thos | last post by:
I have a TcpListener that gets started from a GUI button event handler: TcpListener listener; listener = new TcpListener(IPAddress.Any, 1234); listener.Start(backLog); As soon as the third...
1
by: Darwin | last post by:
Setting a server to listen on 8080 for incoming connections. Written in VS2005 on a Multi-homed machine. I get the warning: Warning 1 'System.Net.Sockets.TcpListener.TcpListener(int)' is obsolete:...
1
by: secutos | last post by:
When a TcpListener accepts a connection, it returns a TcpClient, which allows you to recieve data. But what about TcpListener.Server.Receive? Does that also allow to receive data in the same way? Or...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.