1
IPAddress ip = new IPAddress(new byte[] (127,0,0,0));
TcpClient con = new TcpClient ();
con.Connect(ip,5020);
byte[] dtabfr;
dtabfr = Encoding.ASCII.GetBytes(textBox1.Text);
NetworkStream strm =con.GetStream();
strm.Write(dtabfr,0,dtabfr.Length);
strm.Close();
con.Close();

错误 IPAddress ip 数组创建必须具有数组大小或数组初始值设定项

4

1 回答 1

2

尝试

 IPAddress ip = new IPAddress(new byte[]{127,0,0,0});

或者只是做

var ip = IpAddress.Parse("127.0.0.0");
于 2013-06-13T22:02:02.937 回答