我正在尝试创建TCP连接并发送/读取使用SSL的数据,但我无法成功完成此操作。
我想做的是这样的:
TcpClient _tcpClient = new TcpClient("host", 110);
BinaryReader reader =
new BinaryReader(new System.Net.Security.SslStream(_tcpClient.GetStream(), true));
Console.WriteLine(reader.ReadString());
我虽然没有运气。创建BinaryReader时抛出异常。
有谁知道这样做的一个简单例子?我不想写这个服务器端,只是客户端。