with-client ( remote encoding quot -- )
Networking > Connection-oriented networking
Prev:<client> ( remote encoding -- stream local )
Next:with-local-address ( addr quot -- )


Vocabulary
io.sockets

Inputs and outputs
remotean address specifier
encodingan encoding descriptor
quota quotation


Word description
Opens a network connection and calls the quotation in a new dynamic scope with input-stream and output-stream rebound to the network streams. The local address the socket is connected to is stored in the local-address variable, and the remote address is stored in the remote-address variable.

Errors
Throws an error if the connection cannot be established.

Definition
USING: io.streams.duplex kernel namespaces ;

IN: io.sockets

: with-client ( remote encoding quot -- )
[
[ over remote-address set <client> local-address set ]
dip with-stream
] with-scope ; inline