Solved

Connecting socket to server on Windows Mobile platform

Posted on 2013-10-22
2
497 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
reserve ip address for mac address in ubuntu dhcp server 2 103
Samsung S5 - Bricked?? 5 77
Use T Mobile phones on Verizon network. 4 70
Samsung Dex 3 48
Is your computer hacked? learn how to detect and delete malware in your PC
PRTG Network Monitor lets you monitor your bandwidth usage, so you know who is using up your bandwidth, and what they're using it for.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
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…

733 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