private void button1_Click(object sender, EventArgs e) { sck = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Parse("192.168.0.177"), 80); textBox2.Text = localEndPoint.ToString(); try { sck.Connect(localEndPoint); byte[] bytes = new byte[25]; sck.Receive(bytes);//got hang here string myString = System.Text.Encoding.UTF8.GetString(bytes); textBox1.Text = myString+" a"; sck.Close(); } catch { Console.Write("Unable to Connect \r\n"); textBox1.Text = "error"; } }
receive
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)