I have implemented a Tcp socket client successfully using:
TcpClient tcpClient = new TcpClient(Endpoint);
tcpClient.Connect("127.0.0.1", 3000);
NetworkStream networkStream = tcpClient.GetStream();
Now I am trying to make use the More general Socket class, but I cannot find a method that returns network stream like GetStream
Socket socketClient = new Socket(Endpoint);
socketClient.Connect("127.0.0.1", 3000);
NetworkStream networkStream = socketClient.?????
Use
NetworkStream
to get theStream
:If you want to avoid
using
clause as you mentioned in comments then just don't use it and you can close the stream yourself, just like you said: