private void button1_Click(object sender, EventArgs e)
{
Socket socketWatch = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp );
IPAddress address = IPAddress.Parse(textBox1.Text.Trim());
IPEndPoint endpoint =new IPEndPoint(address,int.Parse(textBox2.Text.Trim()));
socketWatch.Bind(endpoint );
socketWatch.Listen(10);
Socket sockConnection = socketWatch.Accept();
ShowMsg("客户端连接成功");
}
void ShowMsg(string msg)
{
txtMsg.AppendText(msg + "\r\n");
}
在DOS环境下我活的自己电脑的IP是192.168.1.101我默认的端口号是50001,运行起来没有错误,但是我在Dos下输入telnet 192.168.1.101 50001显示“telnet不是内部或外部命令,也不是可运行的程序或批处理文件“,怎么回事啊
|
|