[q] socket and timeout

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[q] socket and timeout

Dmitry Zamotkin-4
Hello,

I should make a request and get response from a Socket constrained by
timeout. I.e.:

myTimeout := 5. "seconds"
[
...
socket sendByteArray: request.
response := socket receiveByteArray: responseSize.
...
] on: TimeoutError do: [ :e | self handleError: e ].

How can I achieve something similar?

--
Dmitry Zamotkin


Reply | Threaded
Open this post in threaded view
|

Re: [q] socket and timeout

Dmitry Zamotkin-4
Another question:

Does anybody try to set SO_SNDTIMEO and SO_RCVTIMEO options with setsockopt
WinSock function? And will it work in Dolphin Smalltalk?

--
Dmitry Zamotkin


Reply | Threaded
Open this post in threaded view
|

Re: [q] socket and timeout

Steve Alan Waring
In reply to this post by Dmitry Zamotkin-4
Hi Dmitry,

AFAIK, For Winsock1.1, there is no way to change the timeout values from the
OS defaults (which I believe are around a couple of minutes).

Dmitry Zamotkin wrote:

> Does anybody try to set SO_SNDTIMEO and SO_RCVTIMEO
> options with setsockopt WinSock function? And will it work
> in Dolphin Smalltalk?

Yes, I did implement these options in Dolphin's Socket class, but they didnt
seem to have any effect. It appears that Dolphin would need to use the
Winsock2 library directly for these options to be available.

> ] on: TimeoutError do: [ :e | self handleError: e ].
> How can I achieve something similar?

The approach I take in my HTTPClient is to fork a timeout process.

   http://www.dolphinharbor.org/dh/projects/httpclient/index.html

Thanks,
Steve


--
Steve Waring
Email: [hidden email]
Journal: http://www.stevewaring.net/blog/home/index.html