with-local-address ( addr quot -- )
Networking > Connection-oriented networking

Prev:with-client ( remote encoding quot -- )
Next:<server> ( addrspec encoding -- server )


Vocabulary
io.sockets

Inputs and outputs
addran inet4 or inet6 address specifier
quota quotation


Word description
Client sockets opened within the scope of the quotation passed to this combinator will have their local address bound to the given address.

Examples
Binds the local address of a newly created client socket within the quotation to 127.0.0.1.This ensures that all traffic originates from the given address (the port is chosen by the TCP stack).
"127.0.0.1" 0 <inet4> [ ] with-local-address


Binds the local address of a newly created client socket within the quotation to the local address 192.168.0.1 and the local port 23000. Be aware that you can only have one client socket with the same local address at a time or else an I/O error ("address already in use") will be thrown.
"192.168.0.1" 23000 <inet4> [ ] with-local-address


Definition