3

What is the difference between TCP listener and TCP server? I want to communicate with some devices using TCP/IP protocol and want PC to organize the communication by using C#.

sanchop22
  • 2,729
  • 12
  • 43
  • 66
  • 1
    Yes, a server listens for connections. There's a TcpListener class in .NET, there is no TcpServer class. The machine on the other end of the wire uses TcpClient. – Hans Passant Mar 22 '12 at 11:53

2 Answers2

10

The .NET class TcpListener implements a TCP server. That’s how the two terms are related. So if you want a TCP server in your application, use the TcpListener.

Timwi
  • 65,159
  • 33
  • 165
  • 230
Roman Starkov
  • 59,298
  • 38
  • 251
  • 324
2

Since you havent posted any specific context. i would refer you some tutorials you can use as a base for TCP communication in c#.

http://www.codeproject.com/Articles/155282/A-Complete-TCP-Server-Client-Communication-and-RMI

http://www.switchonthecode.com/tutorials/csharp-tutorial-simple-threaded-tcp-server

http://www.codeproject.com/Articles/5733/A-TCP-IP-Server-written-in-C

http://www.dreamincode.net/forums/topic/50259-tcp-client-connection/

the previous answer sites the difference.

Rohit Vipin Mathews
  • 11,629
  • 15
  • 57
  • 112