I am new in C# development. I am trying to use ssl/tls over tcp but in my code, system.net.sockets.socket (bare socket) is used not tcpclient or tcplistner. I have searched over net atleast 200 links but I didn't get anything related that. I want to use less coding and done ssl or tsll over tcp socket connection. I have client, server, ca certificate, key in .key format. Please help with example or link. You can ask questions if u feel more details.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Why don't you want to
TcpClient
? Creating a SSL connection withTcpClient
andSsltream
is quite easy. Unless you require thousands of simultaneous connections I would stick withTcpClient
andSSLStream
.A basic
TcpClient
andSslStream
example would be as follows:High performance socket code can be difficult to write in .NET but there are good examples out there. You have a number of choices. I'm not sure one solution fits all so I'll list a few here.
I didn't address SSL specifically but look into the
SslStream
Class.You'll also want to look into buffer pooling. If you're serving thousands of clients garbage collection will be a problem. An excellent introduction to this is Sunny Ahuwanya's Blog
http://nitoasync.codeplex.com/
before.
You should be able to use
System.Net.Sockets.NetworkStream
to wrap your socket and thenSystem.Net.Security.SslStream
to wrap the network stream.