midos
midos

Reputation: 13

Client connect server c# network

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

Answers (1)

Keith Nicholas
Keith Nicholas

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

Related Questions