Simplify writing a string to a socket

STARTTLS fails sometimes because the string length for the `EHLO` command was not set correctly (20 bytes instead of 18).
I introduced a helper method to avoid such mistakes.

[Update:] I used a old version of sslscan. But my helper method simplifies the code.