To use the non-blocking functions like acceptNB and sendVecNB, do I need to explicitly set the socket to non-blocking mode? If that is the case, how can I do it?
Are there any documents/examples on how to generally do non-blocking IO in PolyML?
Thank you,
Vijay
On 07/09/2020 05:59, Vijay Mathew wrote:
To use the non-blocking functions like acceptNB and sendVecNB, do I need to explicitly set the socket to non-blocking mode? If that is the case, how can I do it?
Are there any documents/examples on how to generally do non-blocking IO in PolyML?
You don't have to do anything special to use these calls. To be honest, though, it's probably better to use "select" to check the state of the socket and then use a blocking call. There are a few tests of the non-blocking calls in the Tests/Succeed directory.
David
Hello. I use epoll (kevent) and Socket.sendVecNB:
https://github.com/kni/sml-net-server-ev/blob/3c9dc041e2d46b7ea73f6652435268...
val n = valOf (Socket.sendVecNB (#sock stream, data)) handle exc as OS.SysErr (s, SOME e) => let val en = OS.errorName e in if en = "ECONNRESET" orelse en = "connreset" orelse en = "EPIPE" orelse en = "pipe" then 0 else raise exc end | exc => raise exc
See also https://github.com/kni/sml-net-server-ev/
??, 7 ????. 2020 ?. ? 10:16, Vijay Mathew <vijay.the.lisper at gmail.com>:
To use the non-blocking functions like acceptNB and sendVecNB, do I need to explicitly set the socket to non-blocking mode? If that is the case, how can I do it?
Are there any documents/examples on how to generally do non-blocking IO in PolyML?
Thank you,
Vijay _______________________________________________ polyml mailing list polyml at inf.ed.ac.uk http://lists.inf.ed.ac.uk/mailman/listinfo/polyml