System.net 发送信息的错误(=_=分都在别地方问完了)
private void button1_Click(object sender, EventArgs e){
int port = 2000;
string host = "127.0.0.1";
IPAddress ip = IPAddress.Parse(host);
IPEndPoint ipe = new IPEndPoint(ip, port);
Socket c = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
c.Connect(ipe); ''''这个地方连接不上,是为什么呀
string sendStr = "hello!This is a socket test";
byte[] bs = Encoding.ASCII.GetBytes(sendStr);
c.Send(bs, bs.Length, 0);
string recvStr = "";
byte[] recvBytes = new byte[1024];
int bytes;
bytes = c.Receive(recvBytes, recvBytes.Length, 0);
recvStr += Encoding.ASCII.GetString(recvBytes, 0, bytes);
txtsocket.Text = recvStr;
c.Close();
}
分在别的地方都问完了,竟然没分给了,见笑了=_=
补充:.NET技术 , ASP.NET