Solved

Connecting socket to server on Windows Mobile platform

Posted on 2013-10-22
2
459 Views
Last Modified: 2013-10-23
Hi Experts,
We're using Windows Mobile 6.5.  Our application creates a socket and connects to a Telnet server - we interpret the response from the server and send back user input as required.  Whilst the Windows Mobile device stays awake all is fine.
When the device 'sleeps' and is then woken it attempts to open a new port for the socket connection. This is happening at a lower level than my application, and is not the direct result of my coding.  The result is that the host is confused, seeing two ports from the same device and closes both ( understood from a Wireshark trace ).
Can anyone tell me is this behaviour - i.e. opening a new port on wake-up - is 'normal', or can be disabled ?
Thanks
Mart
0
Comment
Question by:MartinHouse
2 Comments
 
LVL 16

Accepted Solution

by:
hjgode earned 500 total points
ID: 39593312
Using sockets before and after suspend/resume depends on the power management settings and setup of the device. If it shuts down the network (WLAN or WWAN) during suspend, you have to close the socket and open a new connection.

You can watch for power notifications using the MS power notification message queue. The app will receive the "device has suspended" message first after the device is resumed! As the same, close and open connection after resume, is true for serial comm too, I can provide a C++ sample for the power message queue: http://code.google.com/p/win-mobile-code/source/browse/trunk/KeyWedge/KeyWedge/PowerMsgQueue.cpp

Possibly you may want to disable automatic and manual suspend of the device and provide an option to suspend the device from your app. Then you can gracefully close the communication channel.

On the server side you will have to setup the socket to close after some time of inactivity. Otherwise you may run out of communication channels. On the client side you should open and close a comm chanel only as long as you need to transfer data.

The above are general suggestions.

As persisting telnet connections during suspend/resume or WLAN disconnect/connect is a general problm, there are some middel-ware solutions that keep one connection on the telnet server and enable the 'sometimes offline' client to re-use a connection. Intermec provides such a solution named "Session persistence server". There may be other companies providing similar solutions.
0
 
LVL 1

Author Closing Comment

by:MartinHouse
ID: 39593966
Thanks - from your description, I think I need to handle the power down situation
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

With mobile becoming increasingly important to the business world, it is in your best interest to make sure that your email signature looks great across all types of devices. Find out how to create a mobile email signature with this guide.
Is your computer hacked? learn how to detect and delete malware in your PC
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now