adding timeout parameter to socket writer

Workaround for a go1.1.x issue:

https://code.google.com/p/go/issues/detail?id=5932