J
Jerry Spence1
I have been looking at examples of code to create a simple TCP listener on a
certain port.
However they all start off with this line:
Dim tcpListener As New TcpListener(portNumber)
When I code this, I get an error which says that this is obsolete and I
should use tcpListener(IPAddress localaddr int port)
The examples I am looking at are only a few weeks old so I don't understand
why it is obsolete.
I am actually trying to listen for data on port 10002 from a network device
192.168.0.61.
I tried:
Dim ipAddress As ipAddress = Dns.Resolve("localhost").AddressList(0)
Dim tcpListener As New TcpListener(ipAddress,10002)
Dim Listener As New System.Net.Sockets.TcpListener(ipAddress, 10002)
Listener.Start()
Dim tcpClient As tcpClient = Listener.AcceptTcpClient()
but it just sits there and doesn't see any connections coming in.
On the sender side it is sending a short text message on port 10002 to host
192.168.0.2, which is my PC. Is this the same as 127.0.0.0 as defined in the
line:
Dim ipAddress As ipAddress = Dns.Resolve("localhost").AddressList(0)
above?
Thanks
-Jerry
certain port.
However they all start off with this line:
Dim tcpListener As New TcpListener(portNumber)
When I code this, I get an error which says that this is obsolete and I
should use tcpListener(IPAddress localaddr int port)
The examples I am looking at are only a few weeks old so I don't understand
why it is obsolete.
I am actually trying to listen for data on port 10002 from a network device
192.168.0.61.
I tried:
Dim ipAddress As ipAddress = Dns.Resolve("localhost").AddressList(0)
Dim tcpListener As New TcpListener(ipAddress,10002)
Dim Listener As New System.Net.Sockets.TcpListener(ipAddress, 10002)
Listener.Start()
Dim tcpClient As tcpClient = Listener.AcceptTcpClient()
but it just sits there and doesn't see any connections coming in.
On the sender side it is sending a short text message on port 10002 to host
192.168.0.2, which is my PC. Is this the same as 127.0.0.0 as defined in the
line:
Dim ipAddress As ipAddress = Dns.Resolve("localhost").AddressList(0)
above?
Thanks
-Jerry