by Eric Olstad posted on 2005/08/17 |
|
I was excited about this library when I saw all I had to do was put "Secure" in front of the TcpListener, TcpClient and NetworkStream classes of the .NET framework. Unfortunately, it's not that easy and the documentation and samples provided with the library leave something to be desired. The documentation mentions nothing about how to implement a simple client/server application using SecureTcpListener and SecureTcpClient. You would think it would be the same as the .NET framework, but it's not. I get an I/O exception every time I read from the SecureNetworkStream.
Excuse me if I seem angry. I'm extremely frustrated at the shoddy documentation, and the amount of time I've spent scouring through this forum. Why doesn't this work?
// Client
string server = "localhost";
int port = 4200;
SecureTcpClient client = new SecureTcpClient(server, port);
SecureNetworkStream stream = client.GetStream();
string msg = "Hello down there!";
byte[] buff = Encoding.ASCII.GetBytes(msg);
stream.Write(buff, 0, buff.Length);
// Server
SecureTcpListener server = new SecureTcpListener(...);
server.Start();
SecureTcpClient client = server.AcceptTcpClient();
SecureNetworkStream stream = client.GetStream();
int i=0;
byte[] buff = new byte[512];
while ( (i=stream.Read(buff, 0, 512)) != 0)
MessageBox.Show("Message: "+Encoding.ASCII.GetString(buff));
It seems like it should work. It doesn't. And when I start to use SecurityOptions, it doesn't even connect. |
by Valeriu Vrabie [valeriuvrabie at gmail dot com] posted on 2005/08/26 |
|
Hi Eric. If you find out how to work with this SSL, please show me. I have exactly the same problem. I will continue to search, but the progress is not evident. In case, if I will found something, I will let you know.
Thank you!
Best regards,
Valeriu |