C#中TCP通讯可以通过Socket类和TcpClient、TcpListener类实现，具体方法如下：

1. Socket方式：

① 创建一个Socket实例：

```csharp
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
```

② 连接到服务器：

```csharp
IPAddress ipAddress = IPAddress.Parse("服务器IP");
IPEndPoint endPoint = new IPEndPoint(ipAddress, 服务器端口号);
socket.Connect(endPoint);
```

③ 发送数据：

```csharp
byte[] data = Encoding.UTF8.GetBytes("要发送的数据");
int count = socket.Send(data);
```

④ 接收数据：

```csharp
byte[] buffer = new byte[1024];
int count = socket.Receive(buffer);
string receiveData = Encoding.UTF8.GetString(buffer, 0, count);
```

⑤ 关闭连接：

```csharp
socket.Close();
```

2. TcpClient、TcpListener方式：

① 创建一个TcpListener实例：

```csharp
TcpListener listener = new TcpListener(IPAddress.Parse("服务器IP"), 服务器端口号);
```

② 开始监听：

```csharp
listener.Start();
```

③ 接收请求：

```csharp
TcpClient client = listener.AcceptTcpClient();
```

④ 发送数据：

```csharp
byte[] data = Encoding.UTF8.GetBytes("要发送的数据");
NetworkStream stream = client.GetStream();
stream.Write(data, 0, data.Length);
```

⑤ 接收数据：

```csharp
byte[] buffer = new byte[1024];
NetworkStream stream = client.GetStream();
int count = stream.Read(buffer, 0, buffer.Length);
string receiveData = Encoding.UTF8.GetString(buffer, 0, count);
```

⑥ 关闭连接：

```csharp
client.Close();
listener.Stop();
```
