TcpClient Problem

A

Andy Baker

I have a VB.NET 2003 application that has been running successfully on a
device running CE.NET 4.2. I have recently been supplied with the latest
version of the device, which runs CE.NET 5, and also has a different WiFi
adapter to my original version. The application connects to a desktop PC
using a TcpClient as follows:-

Private client as TcpClient
client = New TcpClient(IPAddress, PORT_NUM)

where IPAddress is 192.169.1.10 (the address of the host PC) and PORT_NUM is
a constant - the number of the port I want to use for the connection (10000
in this case). The application on the host PC has a listener object waiting
for a connection on the same port number. On the CE 4.2 device it works
fine, on the new one I get the error message 'No such host is known' after a
few seconds (on the New TcpClient line above). Is this likely to be a CE
problem or a WiFi adapter problem (or something else), and what can I do
about it? Thanks in advance.

Andy Baker
 
P

Paul G. Tobey [eMVP]

It sounds like there is no network path from you, on the device, to the PC.
That's probably not a feature of what sort of an adapter is used, but
whether it's actually connected to the right access point/wireless network.
You should compare the wireless configurations on the two devices...

Paul T.
 
G

Guest

In addition to Paul's comments. Have you tried using the Socket class?
TcpClient can be problematic at times and is not really designed for
enterprise apps. I would stay away from TcpClient.
 
A

Andy Baker

It seems to be more complicated than that. I should have said that I can
ping the host PC from the device successfully using the same IP address as I
am using in the TcpClient I have checked the wireless configuration settings
and they seem to be identical. Under the 'Wireless Information' tab it
reports it as being connected and IP information / subnet mask is correct.
Are there any more settings that I am not aware of?

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
 
A

Andy Baker

I will look at that in the future. Unfortunately time is pressing at the
moment and it worked before so I would prefer not to have to change at
present. Thanks for the suggestion.

Andy Baker
 
P

Paul G. Tobey [eMVP]

No. Connectivity is all you need. Maybe you specified the wrong port
number or something. As Simon said, try plain sockets, if that doesn't seem
to be the problem...

Paul T.

Andy Baker said:
It seems to be more complicated than that. I should have said that I can
ping the host PC from the device successfully using the same IP address as
I am using in the TcpClient I have checked the wireless configuration
settings and they seem to be identical. Under the 'Wireless Information'
tab it reports it as being connected and IP information / subnet mask is
correct. Are there any more settings that I am not aware of?

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
It sounds like there is no network path from you, on the device, to the
PC. That's probably not a feature of what sort of an adapter is used, but
whether it's actually connected to the right access point/wireless
network. You should compare the wireless configurations on the two
devices...

Paul T.
 
A

Andy Baker

I have got it working. I have changed the code to create the TcpClient
first, then connect using an IPAddress rather than a string i.e.
Dim ParsedIPAddress as IPAddress
ParsedIPAddress = IPAddress.Parse("192.168.1.10")
client = New TcpClient
client.Connect(ParsedIPAddress, PORT_NUM)
and it works as it did before on the previous WiFi card/CE combination. I
don't know why it should work with one and not the other, but at least it
gets me out of trouble. Thanks for your help.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
No. Connectivity is all you need. Maybe you specified the wrong port
number or something. As Simon said, try plain sockets, if that doesn't
seem to be the problem...

Paul T.

Andy Baker said:
It seems to be more complicated than that. I should have said that I can
ping the host PC from the device successfully using the same IP address
as I am using in the TcpClient I have checked the wireless configuration
settings and they seem to be identical. Under the 'Wireless Information'
tab it reports it as being connected and IP information / subnet mask is
correct. Are there any more settings that I am not aware of?

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:[email protected]...
It sounds like there is no network path from you, on the device, to the
PC. That's probably not a feature of what sort of an adapter is used,
but whether it's actually connected to the right access point/wireless
network. You should compare the wireless configurations on the two
devices...

Paul T.

I have a VB.NET 2003 application that has been running successfully on a
device running CE.NET 4.2. I have recently been supplied with the latest
version of the device, which runs CE.NET 5, and also has a different
WiFi adapter to my original version. The application connects to a
desktop PC using a TcpClient as follows:-

Private client as TcpClient
client = New TcpClient(IPAddress, PORT_NUM)

where IPAddress is 192.169.1.10 (the address of the host PC) and
PORT_NUM is a constant - the number of the port I want to use for the
connection (10000 in this case). The application on the host PC has a
listener object waiting for a connection on the same port number. On
the CE 4.2 device it works fine, on the new one I get the error message
'No such host is known' after a few seconds (on the New TcpClient line
above). Is this likely to be a CE problem or a WiFi adapter problem (or
something else), and what can I do about it? Thanks in advance.

Andy Baker
 
P

Paul G. Tobey [eMVP]

When you pass a string, that's interpreted as a host name, *NOT* an IP
address.

Paul T.

Andy Baker said:
I have got it working. I have changed the code to create the TcpClient
first, then connect using an IPAddress rather than a string i.e.
Dim ParsedIPAddress as IPAddress
ParsedIPAddress = IPAddress.Parse("192.168.1.10")
client = New TcpClient
client.Connect(ParsedIPAddress, PORT_NUM)
and it works as it did before on the previous WiFi card/CE combination. I
don't know why it should work with one and not the other, but at least it
gets me out of trouble. Thanks for your help.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
No. Connectivity is all you need. Maybe you specified the wrong port
number or something. As Simon said, try plain sockets, if that doesn't
seem to be the problem...

Paul T.

Andy Baker said:
It seems to be more complicated than that. I should have said that I can
ping the host PC from the device successfully using the same IP address
as I am using in the TcpClient I have checked the wireless configuration
settings and they seem to be identical. Under the 'Wireless Information'
tab it reports it as being connected and IP information / subnet mask is
correct. Are there any more settings that I am not aware of?

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message It sounds like there is no network path from you, on the device, to the
PC. That's probably not a feature of what sort of an adapter is used,
but whether it's actually connected to the right access point/wireless
network. You should compare the wireless configurations on the two
devices...

Paul T.

I have a VB.NET 2003 application that has been running successfully on
a device running CE.NET 4.2. I have recently been supplied with the
latest version of the device, which runs CE.NET 5, and also has a
different WiFi adapter to my original version. The application connects
to a desktop PC using a TcpClient as follows:-

Private client as TcpClient
client = New TcpClient(IPAddress, PORT_NUM)

where IPAddress is 192.169.1.10 (the address of the host PC) and
PORT_NUM is a constant - the number of the port I want to use for the
connection (10000 in this case). The application on the host PC has a
listener object waiting for a connection on the same port number. On
the CE 4.2 device it works fine, on the new one I get the error
message 'No such host is known' after a few seconds (on the New
TcpClient line above). Is this likely to be a CE problem or a WiFi
adapter problem (or something else), and what can I do about it?
Thanks in advance.

Andy Baker
 
A

Andy Baker

OK, but why did the other device work - it obviously managed to interpret
the string as an IP address!

Andy

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
When you pass a string, that's interpreted as a host name, *NOT* an IP
address.

Paul T.

Andy Baker said:
I have got it working. I have changed the code to create the TcpClient
first, then connect using an IPAddress rather than a string i.e.
Dim ParsedIPAddress as IPAddress
ParsedIPAddress = IPAddress.Parse("192.168.1.10")
client = New TcpClient
client.Connect(ParsedIPAddress, PORT_NUM)
and it works as it did before on the previous WiFi card/CE combination. I
don't know why it should work with one and not the other, but at least it
gets me out of trouble. Thanks for your help.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:[email protected]...
No. Connectivity is all you need. Maybe you specified the wrong port
number or something. As Simon said, try plain sockets, if that doesn't
seem to be the problem...

Paul T.

It seems to be more complicated than that. I should have said that I
can ping the host PC from the device successfully using the same IP
address as I am using in the TcpClient I have checked the wireless
configuration settings and they seem to be identical. Under the
'Wireless Information' tab it reports it as being connected and IP
information / subnet mask is correct. Are there any more settings that
I am not aware of?

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message It sounds like there is no network path from you, on the device, to
the PC. That's probably not a feature of what sort of an adapter is
used, but whether it's actually connected to the right access
point/wireless network. You should compare the wireless configurations
on the two devices...

Paul T.

I have a VB.NET 2003 application that has been running successfully on
a device running CE.NET 4.2. I have recently been supplied with the
latest version of the device, which runs CE.NET 5, and also has a
different WiFi adapter to my original version. The application
connects to a desktop PC using a TcpClient as follows:-

Private client as TcpClient
client = New TcpClient(IPAddress, PORT_NUM)

where IPAddress is 192.169.1.10 (the address of the host PC) and
PORT_NUM is a constant - the number of the port I want to use for the
connection (10000 in this case). The application on the host PC has a
listener object waiting for a connection on the same port number. On
the CE 4.2 device it works fine, on the new one I get the error
message 'No such host is known' after a few seconds (on the New
TcpClient line above). Is this likely to be a CE problem or a WiFi
adapter problem (or something else), and what can I do about it?
Thanks in advance.

Andy Baker
 
P

Paul G. Tobey [eMVP]

I've never been able to get any of my devices to interpret a string
parameter as a host name. It's possible, I guess, that some setting, a
hosts 'file' setting or something (something that I wouldn't have), allows
that entry to be interpreted that way. I think it would have to be
something that was essentially disconnected from your actual code. In any
case, take care with that parameter...

Paul T.

Andy Baker said:
OK, but why did the other device work - it obviously managed to interpret
the string as an IP address!

Andy

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
When you pass a string, that's interpreted as a host name, *NOT* an IP
address.

Paul T.

Andy Baker said:
I have got it working. I have changed the code to create the TcpClient
first, then connect using an IPAddress rather than a string i.e.
Dim ParsedIPAddress as IPAddress
ParsedIPAddress = IPAddress.Parse("192.168.1.10")
client = New TcpClient
client.Connect(ParsedIPAddress, PORT_NUM)
and it works as it did before on the previous WiFi card/CE combination.
I don't know why it should work with one and not the other, but at least
it gets me out of trouble. Thanks for your help.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message No. Connectivity is all you need. Maybe you specified the wrong port
number or something. As Simon said, try plain sockets, if that doesn't
seem to be the problem...

Paul T.

It seems to be more complicated than that. I should have said that I
can ping the host PC from the device successfully using the same IP
address as I am using in the TcpClient I have checked the wireless
configuration settings and they seem to be identical. Under the
'Wireless Information' tab it reports it as being connected and IP
information / subnet mask is correct. Are there any more settings that
I am not aware of?

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message It sounds like there is no network path from you, on the device, to
the PC. That's probably not a feature of what sort of an adapter is
used, but whether it's actually connected to the right access
point/wireless network. You should compare the wireless
configurations on the two devices...

Paul T.

I have a VB.NET 2003 application that has been running successfully
on a device running CE.NET 4.2. I have recently been supplied with
the latest version of the device, which runs CE.NET 5, and also has a
different WiFi adapter to my original version. The application
connects to a desktop PC using a TcpClient as follows:-

Private client as TcpClient
client = New TcpClient(IPAddress, PORT_NUM)

where IPAddress is 192.169.1.10 (the address of the host PC) and
PORT_NUM is a constant - the number of the port I want to use for
the connection (10000 in this case). The application on the host PC
has a listener object waiting for a connection on the same port
number. On the CE 4.2 device it works fine, on the new one I get the
error message 'No such host is known' after a few seconds (on the
New TcpClient line above). Is this likely to be a CE problem or a
WiFi adapter problem (or something else), and what can I do about
it? Thanks in advance.

Andy Baker
 
P

Paul G. Tobey [eMVP]

Let me try that again. I've not been able to get them to interpret a string
as an *IP address*...

Paul T.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
I've never been able to get any of my devices to interpret a string
parameter as a host name. It's possible, I guess, that some setting, a
hosts 'file' setting or something (something that I wouldn't have), allows
that entry to be interpreted that way. I think it would have to be
something that was essentially disconnected from your actual code. In any
case, take care with that parameter...

Paul T.

Andy Baker said:
OK, but why did the other device work - it obviously managed to interpret
the string as an IP address!

Andy

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:[email protected]...
When you pass a string, that's interpreted as a host name, *NOT* an IP
address.

Paul T.

I have got it working. I have changed the code to create the TcpClient
first, then connect using an IPAddress rather than a string i.e.
Dim ParsedIPAddress as IPAddress
ParsedIPAddress = IPAddress.Parse("192.168.1.10")
client = New TcpClient
client.Connect(ParsedIPAddress, PORT_NUM)
and it works as it did before on the previous WiFi card/CE combination.
I don't know why it should work with one and not the other, but at
least it gets me out of trouble. Thanks for your help.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message No. Connectivity is all you need. Maybe you specified the wrong port
number or something. As Simon said, try plain sockets, if that
doesn't seem to be the problem...

Paul T.

It seems to be more complicated than that. I should have said that I
can ping the host PC from the device successfully using the same IP
address as I am using in the TcpClient I have checked the wireless
configuration settings and they seem to be identical. Under the
'Wireless Information' tab it reports it as being connected and IP
information / subnet mask is correct. Are there any more settings
that I am not aware of?

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
It sounds like there is no network path from you, on the device, to
the PC. That's probably not a feature of what sort of an adapter is
used, but whether it's actually connected to the right access
point/wireless network. You should compare the wireless
configurations on the two devices...

Paul T.

I have a VB.NET 2003 application that has been running successfully
on a device running CE.NET 4.2. I have recently been supplied with
the latest version of the device, which runs CE.NET 5, and also has
a different WiFi adapter to my original version. The application
connects to a desktop PC using a TcpClient as follows:-

Private client as TcpClient
client = New TcpClient(IPAddress, PORT_NUM)

where IPAddress is 192.169.1.10 (the address of the host PC) and
PORT_NUM is a constant - the number of the port I want to use for
the connection (10000 in this case). The application on the host PC
has a listener object waiting for a connection on the same port
number. On the CE 4.2 device it works fine, on the new one I get
the error message 'No such host is known' after a few seconds (on
the New TcpClient line above). Is this likely to be a CE problem or
a WiFi adapter problem (or something else), and what can I do about
it? Thanks in advance.

Andy Baker
 
A

Andy Baker

I'll remember that in future. The problem was that I didn't write the code,
and didn't really look into how it worked. It always worked on the previous
device, and when we got a new device with a different radio card and
different version of CE.NET, I assumed that it had to be one or the other
that was causing the problem. It seems like the question now is why did it
work on the previous device, but I won't worry about that too much!

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam DOT
com> wrote in message news:[email protected]...
I've never been able to get any of my devices to interpret a string
parameter as a host name. It's possible, I guess, that some setting, a
hosts 'file' setting or something (something that I wouldn't have), allows
that entry to be interpreted that way. I think it would have to be
something that was essentially disconnected from your actual code. In any
case, take care with that parameter...

Paul T.

Andy Baker said:
OK, but why did the other device work - it obviously managed to interpret
the string as an IP address!

Andy

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message news:[email protected]...
When you pass a string, that's interpreted as a host name, *NOT* an IP
address.

Paul T.

I have got it working. I have changed the code to create the TcpClient
first, then connect using an IPAddress rather than a string i.e.
Dim ParsedIPAddress as IPAddress
ParsedIPAddress = IPAddress.Parse("192.168.1.10")
client = New TcpClient
client.Connect(ParsedIPAddress, PORT_NUM)
and it works as it did before on the previous WiFi card/CE combination.
I don't know why it should work with one and not the other, but at
least it gets me out of trouble. Thanks for your help.

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no spam
DOT com> wrote in message No. Connectivity is all you need. Maybe you specified the wrong port
number or something. As Simon said, try plain sockets, if that
doesn't seem to be the problem...

Paul T.

It seems to be more complicated than that. I should have said that I
can ping the host PC from the device successfully using the same IP
address as I am using in the TcpClient I have checked the wireless
configuration settings and they seem to be identical. Under the
'Wireless Information' tab it reports it as being connected and IP
information / subnet mask is correct. Are there any more settings
that I am not aware of?

Andy Baker

"Paul G. Tobey [eMVP]" <p space tobey no spam AT no instrument no
spam DOT com> wrote in message
It sounds like there is no network path from you, on the device, to
the PC. That's probably not a feature of what sort of an adapter is
used, but whether it's actually connected to the right access
point/wireless network. You should compare the wireless
configurations on the two devices...

Paul T.

I have a VB.NET 2003 application that has been running successfully
on a device running CE.NET 4.2. I have recently been supplied with
the latest version of the device, which runs CE.NET 5, and also has
a different WiFi adapter to my original version. The application
connects to a desktop PC using a TcpClient as follows:-

Private client as TcpClient
client = New TcpClient(IPAddress, PORT_NUM)

where IPAddress is 192.169.1.10 (the address of the host PC) and
PORT_NUM is a constant - the number of the port I want to use for
the connection (10000 in this case). The application on the host PC
has a listener object waiting for a connection on the same port
number. On the CE 4.2 device it works fine, on the new one I get
the error message 'No such host is known' after a few seconds (on
the New TcpClient line above). Is this likely to be a CE problem or
a WiFi adapter problem (or something else), and what can I do about
it? Thanks in advance.

Andy Baker
 

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