Changed mode from binary to list in gen_tcp:connect.
Writes the sent message for testing purposes.