This module provides TCP/IP sockets. A socket provides a duplex binary stream. The read and write stream can be obtained by the ordinary ISO core standard open/[3,4] predicates. The open options also apply to sockets so that a binary stream can be easily viewed as a text stream in various encodings.Example:
?- client_new('pot.ty', C), open(C, write, S), write_term(S, 'Hello World!'), nl(S), close(C).
A server socket can be created with the predicates server_new/2.
The predicate server_accept/2 delivers a session socket. A client
socket can be created with the predicates client_new/3. Server,
session and client sockets can be closed with the ISO core
standard close/[1,2] predicates.
The predicate websock_new/2 allows promoting a socket to a web socket. The input and output streams will consume and generate web socket frames, but can be used as ordinary ISO core standard streams. During writing a final frame is generated when the predicate flush_output/[1,2] is used.
The following socket predicates are provided: