Socket timeout

  • Thread starter Thread starter Hilton
  • Start date Start date
H

Hilton

Hi,

Is there any way in CF 1.0 to set a socket's timeout without it throwing an
exception?

Thanks,

Hilton
 
I'm not sure what you mean by the question. You can't set socket time-outs
on a per-socket basis, no. You can build your own time-out mechanism by
waiting while the socket does some operation that you might want to time-out
in another thread and, when you decide that the time-out has occurred, close
the socket out from under whatever other call is executing.

Maybe a better description of what you're trying to achieve and why...

Paul T.
 
Paul said:
I'm not sure what you mean by the question. You can't set socket
time-outs on a per-socket basis, no. You can build your own time-out
mechanism by waiting while the socket does some operation that you might
want to time-out in another thread and, when you decide that the time-out
has occurred, close the socket out from under whatever other call is
executing.

Maybe a better description of what you're trying to achieve and why...

Paul,

Well, this call to set a timeout on a socket throws an exception (hence my
question):
socket.SetSocketOption (SocketOptionLevel.Socket,
SocketOptionName.SendTimeout, timeout);

I will definitely try your suggestion. Thank you again,

Hilton
 
Chris,

Thanks for the link. So, it seems that (for whatever reason), we cannot set
a timeout on a socket. I'm going to create a thread as Paul suggested and
hopefully that achieves the same thing.

Thanks again, you guys are great!

Hilton
P.S.: I can't help but chuckle when I hear people from other software
companies say: "We have it working on the desktop so we'll just port it to
the Pocket PC." :) Just to clarify, I love the Pocket PC, CF, and C#, but
writing for the PPC isn't anything like writing for the desktop.
 
Back
Top