Solved

Connecting socket to server on Windows Mobile platform

Posted on 2013-10-22
2
503 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

The case of the missing phone talks about the way a small electronic gadget (the mobile phone) has penetrated into our lives and has made us addicted to it.
Use of TCL script on Cisco devices:  - create file and merge it with running configuration to apply configuration changes
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

623 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