private void sendData(String data) { IPAddress ipep =IPAddress.Parse(comboBox1.SelectedItem.ToString()); Socket server = new Socket(AddressFamily.InterNetwork , SocketType.Stream, ProtocolType.Tcp); IPEndPoint ipept = new IPEndPoint( ipep, hostPort); //TcpClient cl = new TcpClient(ipept.Address.ToString(), hostPort); NetworkStream nStream = tcpClient.GetStream(); ASCIIEncoding asciidata = new ASCIIEncoding(); byte[] buffer = asciidata.GetBytes(data); if (nStream.CanWrite) { nStream.Write(buffer, 0, buffer.Length); nStream.Flush(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)