14.5.1 TCP
| annotation | ||
| 
 | ||
| function | ||
| 
 | ||
| 
 | ||
| function | ||
The TCP.addresses function returns a connection’s local IP address and port number followed by the connection peer’s IP address and port number.
The TCP.abandon function is almost the same as closing a port with Port.Input.close or Port.Output.close, but in in the case of closing an output port, the connection peer does not receive an end-of-file in its input stream.
| function | ||||||||
| 
 | 
If local_host or local_port is not #false, it can determine the interface (at the operating-system level) on the local machine that is used for the TCP connection.
If wait is #'enable_break and breaks are currently disabled, then breaks are enabled while waiting for the connection to be created. In that case, either an Exn.Break exception is thrown or a connection and ports are created, but not both.
Since TCP.connect returns two ports, it can be used with Closeable.let.
| class | ||||||||
| 
 | ||||||||
| 
 | ||||||||
| function | ||||||||
| 
 | 
If host is not #false, it determines the IP addresses and interfaces that accept connections for the listener. The reuse and max_allow_wait arguments similarly configure the created listener.
The TCP.listen function accepts the same arguments as the TCPListener constructor and returns a listener created with those arguments.
Since TCPListener implements Closeable, the TCPListener constructor or TCP.listen function can be used with Closeable.let.
| method | ||||
| 
 | ||||
| 
 | ||||
| method | ||||
| 
 | ||||
| 
 | ||||
| method | ||||
| 
 | 
The TCPListener.accept_ready method reports whether a TCPListener.accept call will complete immediately because a connection is available.
The TCPListener.accept_evt method returns a synchronizable event that is ready for synchronization when a connection is available. The synchronization result is a PairList of containing two values, which are ports like the two results of TCPListener.accept.
| method | ||
| 
 | 
| method | |
| 
 |