Problem on starting Wireless TCP communication from server

Z

Zeno Loco

Hi,

I am testing an application that must manage Wireless data
communication between a server and mobile devices.
Both, clients and server, have a background TCP socket.
My problem is that, server side, I found big difficulties to begin the
connection with clients.
I observe the same results pinging the client (in my test a Dell Axinm)
from server.
Sometimes the ping succeed but often (the majority) it fails; if it
succeed, for a period, continues to succeed, if it fails continues to
fail and sometimes I have to force a ping from client for re-activate
client side pinging.
It seems to me that there is in the device a mechanism of wireless comm
sleeping and waking up.

On the other side if the TCP connection is started by the mobile
dervice, it always works propwerly.

Any idea?

Thanks
 
P

Paul G. Tobey [eMVP]

No, no ideas. Ping isn't a reliable delivery protocol. I'd be happy to
have 3 out of 4 ping packets dropped if the processor time is needed for
something more important. This fragment, in particular, does not describe
something that I understand, "if it fails continues to fail and sometimes I
have to force a ping from client for re-activate client side pinging." Huh?
I think that we need a clear description of what's actually going on, who is
sending what to whom, and what your code is doing during all of this.

Paul T.
 
Z

Zeno Loco

Paul,
I know my english is terrible, I'll try to explain.
The test I have done, are not using code but trying to reach the mobile
device using the command ping from cmd windows.
When I ping the device from my desktop (ping 192.168.1.101), I often
receive the "Request timed out" response.
On the other way, when I call the desktop from the device (using
192.168.1.2 IP address from the Dell Wlan Utility of my device), the
connection is immediately on.
And my impression is that, when the device is contacting the desktop
(and so when the wireless activity is on in the device) the desktop can
reach the device very easily (the 4 ping responses are "Reply from...")
..

Code implication are, in this situation, that messages sent from the
device to the desktop always arrive to destination but in the opposite
direction, from desktop to device, the following ConnectCallbak
routines :

Private Sub ConnectCallback(ByVal ar As IAsyncResult)
Dim client As Socket = CType(ar.AsyncState, Socket)

Try
client.EndConnect(ar) <--- here is the exception
mCommunicationLayer.Display(String.Format("Connesso a
{0}", client.RemoteEndPoint.ToString()))
Catch exc As SocketException
If exc.SocketErrorCode = 10061 Then
mCommunicationLayer.SndFailed("Il server non è
raggiungibile", True)
Else
mCommunicationLayer.SndFailed(exc.Message, True)
End If
client.Close()
Catch exc As Exception
mCommunicationLayer.SndFailed(exc.Message, True)
End Try

ConnectDone.Set()
End Sub

raise the exception "A connection attempt failed because the connected
party did not properly respond after a period of time, or established
connection failed because connected host has failed to respond"

Finally, in some "magic" moments all seems to work properly (ping and
code are OK).
 
P

Paul G. Tobey [eMVP]

So, good, we can ignore any possible coding errors on your end. For now,
I've ignored your code completely and will just address trying to get ping
to work at least the majority of the time.

And the device, when you are trying to ping it at 192.168.1.101, is
*statically* assigned that IP address or assigned that address by some DHCP
server? I suppose that the same question probably applies to the desktop.
When the ping from the PC fails, you might try to verify that the device
*is* in fact connected to the wireless network, that it *does* have the IP
that you're expecting, and that the subnet mask is correct. It's possible
that this is a subnetting problem on one end or the other (probably on the
device end, given the symptoms).

Paul T.

Paul,
I know my english is terrible, I'll try to explain.
The test I have done, are not using code but trying to reach the mobile
device using the command ping from cmd windows.
When I ping the device from my desktop (ping 192.168.1.101), I often
receive the "Request timed out" response.
On the other way, when I call the desktop from the device (using
192.168.1.2 IP address from the Dell Wlan Utility of my device), the
connection is immediately on.
And my impression is that, when the device is contacting the desktop
(and so when the wireless activity is on in the device) the desktop can
reach the device very easily (the 4 ping responses are "Reply from...")
..

Code implication are, in this situation, that messages sent from the
device to the desktop always arrive to destination but in the opposite
direction, from desktop to device, the following ConnectCallbak
routines :

Private Sub ConnectCallback(ByVal ar As IAsyncResult)
Dim client As Socket = CType(ar.AsyncState, Socket)

Try
client.EndConnect(ar) <--- here is the exception
mCommunicationLayer.Display(String.Format("Connesso a
{0}", client.RemoteEndPoint.ToString()))
Catch exc As SocketException
If exc.SocketErrorCode = 10061 Then
mCommunicationLayer.SndFailed("Il server non è
raggiungibile", True)
Else
mCommunicationLayer.SndFailed(exc.Message, True)
End If
client.Close()
Catch exc As Exception
mCommunicationLayer.SndFailed(exc.Message, True)
End Try

ConnectDone.Set()
End Sub

raise the exception "A connection attempt failed because the connected
party did not properly respond after a period of time, or established
connection failed because connected host has failed to respond"

Finally, in some "magic" moments all seems to work properly (ping and
code are OK).
 
Z

Zeno Loco

I also think is not a code problem.

The settings of the wireless adapter (Dell Wlan Driver) in the device
are the following :

Static IP
IP Address 192.168.1.101
Subnet Mask : 255.255.255.0
Gateway: none
No DNS and WINS

The stange thing (is for this reason I think about a sleeping and
waking mechanism) is that in a laptop PC with a similar configuration
(IP Address 192.168.1.101), the wireless connection is almost always
possible.

Thanks for your interest

Zeno
 
P

Paul G. Tobey [eMVP]

And the subnet mask of the PC with which you are trying to communicate?
Make sure that you don't have more than one device with the same IP, also!
(You say, "IP Address 192.168.1.101" and "...laptop PC with a similar
configuration
(IP Address 192.168.1.101)")

Paul T.

I also think is not a code problem.

The settings of the wireless adapter (Dell Wlan Driver) in the device
are the following :

Static IP
IP Address 192.168.1.101
Subnet Mask : 255.255.255.0
Gateway: none
No DNS and WINS

The stange thing (is for this reason I think about a sleeping and
waking mechanism) is that in a laptop PC with a similar configuration
(IP Address 192.168.1.101), the wireless connection is almost always
possible.

Thanks for your interest

Zeno
 
Z

Zeno Loco

Sorry there were a mistake in my previous post (the laptop IP Addr was
IP Address 192.168.1.100).
The PC subnet mask is 255.255.255.0
The PC Gateway is : 192.168.1.254 (the address of the Wirless Router)

Zeno
 
P

Paul G. Tobey [eMVP]

OK, but then you haven't said what the IP of the device is. I don't see
anything wrong with those settings that would explain what you're seeing. I
suppose that you should verify that you are not using any network setups on
the PC which might result in traffic being denied (firewall), rerouted
(VPN), etc.

Paul T.

Sorry there were a mistake in my previous post (the laptop IP Addr was
IP Address 192.168.1.100).
The PC subnet mask is 255.255.255.0
The PC Gateway is : 192.168.1.254 (the address of the Wirless Router)

Zeno
 
Z

Zeno Loco

Thank you very much Paul,
I'll control everything

Zeno

OK, but then you haven't said what the IP of the device is. I don't see
anything wrong with those settings that would explain what you're seeing.I
suppose that you should verify that you are not using any network setups on
the PC which might result in traffic being denied (firewall), rerouted
(VPN), etc.

Paul T.

Sorry there were a mistake in my previous post (the laptop IP Addr was
IP Address 192.168.1.100).
The PC subnet mask is 255.255.255.0
The PC Gateway is : 192.168.1.254 (the address of the Wirless Router)

Zeno
And the subnet mask of the PC with which you are trying to communicate?
Make sure that you don't have more than one device with the same IP, also!
(You say, "IP Address 192.168.1.101" and "...laptop PC with a similar
configuration
(IP Address 192.168.1.101)")

Paul T.

I also think is not a code problem.

The settings of the wireless adapter (Dell Wlan Driver) in the device
are the following :

Static IP
IP Address 192.168.1.101
Subnet Mask : 255.255.255.0
Gateway: none
No DNS and WINS

The stange thing (is for this reason I think about a sleeping and
waking mechanism) is that in a laptop PC with a similar configuration
(IP Address 192.168.1.101), the wireless connection is almost always
possible.

Thanks for your interest

Zeno
So, good, we can ignore any possible coding errors on your end. For
now,
I've ignored your code completely and will just address trying to get
ping
to work at least the majority of the time.

And the device, when you are trying to ping it at 192.168.1.101, is
*statically* assigned that IP address or assigned that address by some
DHCP
server? I suppose that the same question probably applies to the
desktop.
When the ping from the PC fails, you might try to verify that the device
*is* in fact connected to the wireless network, that it *does* have the
IP
that you're expecting, and that the subnet mask is correct. It's
possible
that this is a subnetting problem on one end or the other (probably on
the
device end, given the symptoms).

Paul T.

Paul,
I know my english is terrible, I'll try to explain.
The test I have done, are not using code but trying to reach the mobile
device using the command ping from cmd windows.
When I ping the device from my desktop (ping 192.168.1.101), I often
receive the "Request timed out" response.
On the other way, when I call the desktop from the device (using
192.168.1.2 IP address from the Dell Wlan Utility of my device), the
connection is immediately on.
And my impression is that, when the device is contacting the desktop
(and so when the wireless activity is on in the device) the desktop can
reach the device very easily (the 4 ping responses are "Reply from...")
.

Code implication are, in this situation, that messages sent from the
device to the desktop always arrive to destination but in the opposite
direction, from desktop to device, the following ConnectCallbak
routines :

Private Sub ConnectCallback(ByVal ar As IAsyncResult)
Dim client As Socket = CType(ar.AsyncState, Socket)

Try
client.EndConnect(ar) <--- here is the exception
mCommunicationLayer.Display(String.Format("Connesso a
{0}", client.RemoteEndPoint.ToString()))
Catch exc As SocketException
If exc.SocketErrorCode = 10061 Then
mCommunicationLayer.SndFailed("Il server non è
raggiungibile", True)
Else
mCommunicationLayer.SndFailed(exc.Message, True)
End If
client.Close()
Catch exc As Exception
mCommunicationLayer.SndFailed(exc.Message, True)
End Try

ConnectDone.Set()
End Sub

raise the exception "A connection attempt failed because the connected
party did not properly respond after a period of time, or established
connection failed because connected host has failed to respond"

Finally, in some "magic" moments all seems to work properly (ping and
code are OK).


Paul G. Tobey [eMVP] wrote:
No, no ideas. Ping isn't a reliable delivery protocol. I'd be happy
to
have 3 out of 4 ping packets dropped if the processor time is needed
for
something more important. This fragment, in particular, does not
describe
something that I understand, "if it fails continues to fail and
sometimes
I
have to force a ping from client for re-activate client side pinging."
Huh?
I think that we need a clear description of what's actually going on,
who
is
sending what to whom, and what your code is doing during all of this.

Paul T.

Hi,

I am testing an application that must manage Wireless data
communication between a server and mobile devices.
Both, clients and server, have a background TCP socket.
My problem is that, server side, I found big difficulties to begin
the
connection with clients.
I observe the same results pinging the client (in my test a Dell
Axinm)
from server.
Sometimes the ping succeed but often (the majority) it fails; if it
succeed, for a period, continues to succeed, if it fails continues
to
fail and sometimes I have to force a ping from client for
re-activate
client side pinging.
It seems to me that there is in the device a mechanism of wireless
comm
sleeping and waking up.

On the other side if the TCP connection is started by the mobile
dervice, it always works propwerly.

Any idea?

Thanks
 

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