Here is a sample code that sets up a TCP listener in C# and listens for incoming connections. Once a client connects, it reads all data available and disconnects the client.
main.cs1224 chars44 lines
Note that this code only reads the data that is available at the time of the connection. If you need to read more data or if the data is being sent in chunks, you will need to implement a loop to read all data.
gistlibby LogSnag