My understanding for now about client-server connections in C#:
- TCPListener = Server
- TCPClient = Client
In alternative to this exists a "Socket" class which can be used as Client and as Server, but at the end do both variants the same thing?!
I understand the TCPClient. It has a getStream() method, which returns a NetWorkStream which has methods for read and write from/to the stream.
My problem is the TCPListener on the server-side. The TCPListener has not a getStream() method and also no read/write method. How i can read/write from the TCPListener from/to the stream?
while(true) { var tcpClient = tcpListener.AcceptTcpClient(); /*use tcpClient*/ }
– L.B