package affect
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=b328f6696e60c489da8cc2e8fad0537ca6634a39fc0c5de5840d4f98561f110617ef79ba8285ee8427dd99908c6b3d39114973598cddc5ded91abcce3b91b9a6
doc/affect.tmp/Net/Msg/index.html
Module Net.MsgSource
Send and receive messages over stream sockets.
Using simple length-value frames.
Sending
send c msg sends the bytes msg on c. The result is:
Ok ()if the frame formsgwas seemingly sent successfuly.Error eif the peer unexpectedly closed the connection or another error occurs. In this case you should proceed toConnection.close_noerrthe connection.
send' is like send but you get the unix error status on error, in case you want to try to (unreliably) reason on the peer closure.
wait_sendable c tag is the action used by send. The action invocation is enabled and synchronizes with tag when a send can be initiated without blocking. However since multiple write(2) may be needed, the call can still block. This is just Affect_unix.Unix.wait_writable on the connection's file descriptor.
Receiving
recv c receives a message from c. The result is:
Ok (Some msg)ifmsgwas received in a frame.Ok Noneif the connection was closed gracefuly (0bytes were read at the beginning of the frame).Error eis the peer unexpectedly closed the connection, if a frame is truncated or invalid, or if any other error occurs. In this case you should proceed toConnection.close_noerrthe connection.
wait_recvable c tag is the action used by recv. The action invocation is enabled and synchronizes with tag when a recv can be initiated without blocking. However since mulitple read(2) may be needed the call can still block. This is just Affect_unix.Unix.wait_readable on the connection's file descriptor.