Sign in to follow this  
WizHarDx

winsock 1.1 Connect

Recommended Posts

WizHarDx    190
Hi ive written a client application which runs on wince. Ive got communication working perfectly. Im currently working on the connection logic because internet connection through gprs can be lost easily due to signal loss. Anyway ive come across the most annoying error. When the pocket pc is in the cradle. If the server application isn't running on the server. The connect function is still sucessful. Ive read the connect function documentation like 20 times now. When I try both blocking and non-blocking it still indicates a connection i.e.: blocking socket = connect returns 0 nonblocking socket = connect returns SOCKET_ERROR the error is 10035 and when select is called it says the socket is writable and therefore connected I have no idea what it is. The only thing I can think of is that activesync may trick the device into thinking its connect ? thank-you very much in advance Iain Fraser

Share this post


Link to post
Share on other sites
kuphryn    210
Winsock returns WSAEWOULDBLOCK indicating that the socket connection will be completed soon. So the connection is established and you can now do non-blocking I/O.

Kuphryn

Share this post


Link to post
Share on other sites
hplus0603    11356
I believe the implementation for WinCE might play funky tricks with connection state, to avoid distressing application software. You'll have to detect non-connection through time-outs.

Share this post


Link to post
Share on other sites
WizHarDx    190
ive read the documentation many times over:

According to the documentation, both the results I got for a blocking and non blocking socket suggest that the socket is connected.

I think hplus0603 must be right. Ive just ignored the problem for now b/c the socket disconnects as soon as the first recv function is called it returns 0.

This is annoying because ive got these little circles at the top of the title bar of my application. Which go green when there is a connection and red when there isn't. So when its in its cradle and there is no server running its flickers from green to red.

I got round this by just putting a ( n seconds) before it retry's a connection.

Im gonna look into hplus0603 idea. Ill report back because im sure alot of people in the future will also find this bug.

Another idea I had and I don't know where to look to see if this is true?

My idea is, when your in cradle mode and you try setup a socket connection to a server on the desktop. Activesync acts like a intermediate layer.

PP(pocket pc) socket to ActiveSync to Server Application

this would explain why a connection is always made. Because it will always get a socket to ActiveSync. Which then trys to pass it onto the the Server Application.

Is this complete and utter rubbish?

thank-you again very much
Iain

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this