Наверное, можно так:
## Код:
```
string message;

message = TCPStreamIO.ReceiveString(POSIPStream);
if (message != null) safeLogAppend(message);

while (message != null && SrvIPStream != null && SrvIPStream.CanWrite)
{
   TCPStreamIO.SendMsg(SrvIPStream, message + "\n");
   message = TCPStreamIO.ReceiveString(POSIPStream);
   if (message != null) safeLogAppend(message);
}
```
