Socket Connected Property problem

  • Thread starter Thread starter TechGladiator
  • Start date Start date
T

TechGladiator

I know that there is a problem with the Connected property in the
sockets in CF. I try to connect to my server app from my CF app and
even thought it is not connected it shows that it is. I know I can
use the SendMessage to send something to the server but If it doesnt
find the server it waits for about 50 secs or so. What I want to do is
implement some kind of timeout using the reg sockets class so if it
doesnt connect in say like 20 secs I can return to the app.

Is there anything I can do? is there anyway to implement timeout with
sockets

Thanks
Mike
 
You will want to use Async. sockets instead of Sync. sockets. Look at the
Beginxxxx methods (BeginConnection, BeginSend, etc.) There are several
class out there that have an implementation already done for Async. sockets
so you might use one of them as a template.

Also, the CF does not support the SetSocketOption for timeout (it supports
it in terms of compile but at runtime you get a unsupported exception.)
 
Back
Top