Check status from write operation

The socket does not check if sending succeeded. In fact we're using an
assert which will just terminate the program if it fails. Make the send:
method return return the status of the operation,

Signed-off-by: Marcus Karlsson <mk@acc.umu.se>