资源介绍
try
{
TcpClient = new TcpClient(txtServerIp.Text, int.Parse(txtPort.Text.Trim()));
Stream = TcpClient.GetStream();
ClientReader = new StreamReader(Stream);
ClientWriter = new StreamWriter(Stream);
txtServerIp.Enabled = false;
btnConnect.Enabled = false;
this.Text = "客户端 " + "正在与" + txtServerIp.Text.Trim() + "连接……";
return;
}
catch
{
txtServerIp.Enabled = true;
btnConnect.Enabled = true;
this.Text = "连接失败……";
//MessageBox.Show("连接失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
- 上一篇: TCP服务(C#的多线程多客户端异步聊天通讯源码)
- 下一篇: VB 三菱FX PLC编程口通讯实例