For this exercise a program is open a socket to localhost on port 256 and send the message "hello socket world" before closing the socket.

Catching any exceptions or errors is not required.




-module(socket).
-export([start/0]).
 
start() ->
    {ok, Sock} = gen_tcp:connect("localhost", 256,
                                 [binary, {packet, 0}]),
    ok = gen_tcp:send(Sock, "hello socket world"),
    ok = gen_tcp:close(Sock).
 