I am a bit confused with the TcpClient
class. I want to connect to my server and have 2 streams. One SSL and one regular non secure TCP.
So i connect like this currently:
await _tcpClient.ConnectAsync(address,port);
IsConnected = true;
_networkStream = _tcpClient.GetStream();
_sslStream = new SslStream(_tcpClient.GetStream());
The problem is my ssl data i want to use on a different port. So do i need to have two TcpClient instances one for secure and one for non secure? Or can i have multiple streams on different ports with this class. I am confused how its done? I am really confused how this is meant to be setup properly.
Yes, you will need two separate Socket
instances. You could to that via two instances of TcpClient
- personally I tend to prefer raw sockets, but that's up to you.