diff options
Diffstat (limited to 'erts/doc')
-rw-r--r-- | erts/doc/src/socket.xml | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/erts/doc/src/socket.xml b/erts/doc/src/socket.xml index 795df0d238..caf7058b34 100644 --- a/erts/doc/src/socket.xml +++ b/erts/doc/src/socket.xml @@ -614,14 +614,13 @@ <title>Examples</title> <marker id="examples"></marker> <code type="none"> -client(Addr, Port) -> +client(Addr, SAddr, SPort) -> {ok, Sock} = socket:open(inet, stream, tcp), - ok = socket:bind(Sock, #{family => inet, - port => 0, - addr => any}), + {ok, _} = socket:bind(Sock, #{family => inet, + addr => Addr}), ok = socket:connect(Sock, #{family => inet, - addr => Addr, - port => Port}), + addr => SAddr, + port => SPort}), Msg = list_to_binary("hello"), ok = socket:send(Sock, Msg), ok = socket:shutdown(Sock, write), @@ -630,9 +629,9 @@ client(Addr, Port) -> server(Addr, Port) -> {ok, LSock} = socket:open(inet, stream, tcp), - ok = socket:bind(LSock, #{family => inet, - port => Port, - addr => Addr}), + {ok, _} = socket:bind(LSock, #{family => inet, + port => Port, + addr => Addr}), ok = socket:listen(LSock), {ok, Sock} = socket:accept(LSock), {ok, Msg} = socket:recv(Sock), |