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数组创建必须具有数组大小或数组初始化程序
答案 0 :(得分:2)
试
IPAddress ip = new IPAddress(new byte[]{127,0,0,0});
或只是做
var ip = IpAddress.Parse("127.0.0.0");