Hello Chun,
I will supply a patch to implement all these soon.
The 'ext:connect-to-inet-socket timeout has been included for some time, and this is the timeout for the connection attempt alone and does not affect the returned socket.
The stream timeout can be accessed using 'ext:stream-timeout, see: http://www.scieneer.com/scl/doc/function/ext/stream-timeout.html
The stream deadline can be accessed using the 'ext:stream-expiration, see: http://www.scieneer.com/scl/doc/function/ext/stream-expiration.html
Adding a 'socket-set-option would also work well. A 'nodelay argument can be added to 'ext:connect-to-inet-socket and/or 'ext:accept-tcp-connection if this is the preferred interface.
There are internal functions: 'ext::set-socket-option, and 'ext::set-socket-tcp-nodelay and one or both could be exported if it helps support usocket.
Regards Douglas Crosher
Chun Tian (binghe) wrote:
Hi, Douglas
By reading SCL 1.3.8 documents, I saw the TIMEOUT keyword in EXT:CONNECT-TO-INET-SOCKET, so I guess just use this keyword will be OK to add support for TIMEOUT in USOCKET:SOCKET-CONNECT. more questions:
- From which version of SCL, the TIMEOUT keyword be added? All SCL
version or there's some way we can detect whether TIMEOUT can be used? (i.e *features*, fboundp, ...)
How to support DEADLINE in SCL? (I can find details from SCL doc)
What if we (usocket) don't split out DEADLINE from SOCKET-CONNECT but
add a new SET-SOCKET-OPTION to set the behavior of a already created socket?
Regards,
Chun Tian (binghe)
Hello Erik,
Thank you for the update.
The nodelay socket option can be supported in the Scieneer CL. It may also be useful to add this option to 'socket-accept, or perhaps split this out into a separate function that can be used to enable or disable the Nagle algorithm.
The Scieneer CL streams support both the timeout and the deadline, but also allow these to be reset and for the remaining time to be read which is important for many applications. For example a web server can reset the deadline at the start of a new request. So perhaps this functionality could be split out from 'socket-connect.
Regards Douglas Crosher
...
A number of smaller features (options to SOCKET-CONNECT) have also been added, however, these may not be available on all implementations:
- :no-delay, which disables Naggle's algorithm
- :timeout, which sets a per-operation timeout on the socket
- :deadline, which sets a maximum life-time to the socket
...
As always, any feedback - bugs or hugs - is greatly appreciated. If you use usocket, please let us know what for!
usocket-devel mailing list usocket-devel@common-lisp.net http://common-lisp.net/cgi-bin/mailman/listinfo/usocket-devel