110,538
社区成员
发帖
与我相关
我的任务
分享
private void Form1_Load(object sender, EventArgs e)
{
richTextBox1.Text+="Server\n";
IPAddress ip=new IPAddress(new byte[] {127, 0, 0, 1});
TcpListener listener=new TcpListener(ip, 8500);
listener.Start();
richTextBox1.Text+="Listen start ...\n";
while(true) {
TcpClient remoteClient=listener.AcceptTcpClient();
richTextBox1.Text+=string.Format("Client Connected! {0} --> {1}",
remoteClient.Client.LocalEndPoint, remoteClient.Client.RemoteEndPoint);
}
}
while(true) {
TcpClient remoteClient=listener.AcceptTcpClient();
richTextBox1.Text+=string.Format("Client Connected! {0} --> {1}",
remoteClient.Client.LocalEndPoint, remoteClient.Client.RemoteEndPoint);
}