[sockets] do not hardcode length of buffer