add check for SocketAndStreams in sendAndReceive