Reputation: 13
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();
Error IPAddress ip Array creation must have array size or array initializer
Upvotes: 1
Views: 111
Reputation: 44288
try
IPAddress ip = new IPAddress(new byte[]{127,0,0,0});
or just do
var ip = IpAddress.Parse("127.0.0.0");
Upvotes: 2