Allow writes only when socket is in connected state