Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Connecting socket to server on Windows Mobile platform

Posted on 2013-10-22
2
Medium Priority
?
517 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 2000 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

Lessons on Wi-Fi & Recommendations on KRACK

Simplicity and security can be a difficult  balance for any business to tackle. Join us on December 6th for a look at your company's biggest security gap. We will also address the most recent attack, "KRACK" and provide recommendations on how to secure your Wi-Fi network today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to set-up an On Demand, IPSec, Site to SIte, VPN from a Draytek Vigor Router to a Cyberoam UTM Appliance. A concise guide to the settings required on both devices
If your app took Google’s lash recently, here are the 5 most likely reasons.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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…
Suggested Courses

916 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