473,800 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

New constructor for TCPListener

I use in vb (VS2005)

Server = New TcpListener(Por tNumber)

Which is simple and straightforward . But I get
Public Sub New(port As Integer) is obsolete: This method has been
deprecated. Please use TcpListener(IPA ddress 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 3995
Hello,

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

Kind regards,
Henning Krause

"Jon Jacobs" <Jo*******@disc ussions.microso ft.comwrote in message
news:62******** *************** ***********@mic rosoft.com...
>I use in vb (VS2005)

Server = New TcpListener(Por tNumber)

Which is simple and straightforward . But I get
Public Sub New(port As Integer) is obsolete: This method has been
deprecated. Please use TcpListener(IPA ddress 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
18444
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 so. Is there a walkaround? Thanks for any tip.
4
6727
by: byron guerrero | last post by:
I need to execute a TcpListener in a windows service. tanks for the help.
1
1819
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 something to do with process groups or threads and closeOnExec semantics (to speak in POSIX terms) is causing me a problem. I've got a windows service (let's call it "myService") that, among other things, does : onStart creates a TcpListener on a...
1
6594
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 the default timeout of TcpListener? How can we change it? Thanks
4
4402
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 IPEndPoint(localAddress, 9000); TcpListener tcpListen = new TcpListener(localEP); tcpListen.Start(); Socket skt = tcpListen.AcceptSocket(); .... do some socket stuff skt.Close();
3
4375
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 while the listener is awaiting for socket to connect several other applications can't start, and even installation of new applications migth hang. In order to finalise the other apps or installations the tcp listener is killed resulting in the other...
4
3525
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 line runs, the app freezes, the CPU goes to 100% on that CPU (Core Duo) and debugging can't break out of it. I can't even stop the process with the Task Manager but have to reboot to get
1
8641
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: 'This method has been deprecated. Please use TcpListener(IPAddress localaddr, int port) instead. on the code: TcpListener tcpListener = new TcpListener(8080); Do I really have to specify every IP address that I want to listen on?
1
2941
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 does the TcpClient returned only recieve data from that current connection while TcpListener.Server.Receive receives data from all connections? I do have mutliple connections in my TcpListener.
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10276
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10035
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9090
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7580
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.