A
Andre Azevedo
Hi all,
I'm using async NetworkStream methods in my client/server socket app and
it's working fine.
But after using CryptoStream (base64) in NetworkStream it doesn't work. The
following code runs on both client and server:
---
tcpclass.networkStream = new NetworkStream(tcpclass.Socket);
tcpclass.sendStream = tcpclass.networkStream;
tcpclass.receiveStream = tcpclass.networkStream;
tcpclass.sendStream = new CryptoStream(tcpclass.sendStream, new
ToBase64Transform(), CryptStreamMode.Write);
tcpclass.receiveStream = new CryptoStream(tcpclass.receiveStream, new
FromBase64Transform(), CryptStreamMode.Read);
----
tcpclass.sendStream.BeginWrite(outBuffer,....)
---
tcpclass.receiveStream.BeginRead(inBuffer...)
---
If the server uses the CryptoStream and the client only uses NetworkStream,
the client can receive the encoded message. But if client also uses
CryptoStream, it can't read anything.
Any help will be apreciated!
Thanks,
I'm using async NetworkStream methods in my client/server socket app and
it's working fine.
But after using CryptoStream (base64) in NetworkStream it doesn't work. The
following code runs on both client and server:
---
tcpclass.networkStream = new NetworkStream(tcpclass.Socket);
tcpclass.sendStream = tcpclass.networkStream;
tcpclass.receiveStream = tcpclass.networkStream;
tcpclass.sendStream = new CryptoStream(tcpclass.sendStream, new
ToBase64Transform(), CryptStreamMode.Write);
tcpclass.receiveStream = new CryptoStream(tcpclass.receiveStream, new
FromBase64Transform(), CryptStreamMode.Read);
----
tcpclass.sendStream.BeginWrite(outBuffer,....)
---
tcpclass.receiveStream.BeginRead(inBuffer...)
---
If the server uses the CryptoStream and the client only uses NetworkStream,
the client can receive the encoded message. But if client also uses
CryptoStream, it can't read anything.
Any help will be apreciated!
Thanks,