private void btnTcpClient_Click(object sender, EventArgs e) { byte[] sendData = Encoding.UTF8.GetBytes(textBox1.Text); if (_tcpClient == null) { _tcpClient = new TCPClientBase(); } _tcpClient.SocketStart(@"127.0.0.1", 9999); if (_tcpClient.isConnection) { textBox1.Text = "已连接上服务器"; } }
/// <summary> /// Send a presence error /// </summary> /// <param name="stream">The stream that will receive the error</param> /// <param name="code">The error code</param> /// <param name="error">A string containing the error</param> public static void SendGPError(TCPClientBase client, object errorCode, string error) { string sendingBuffer = string.Format(@"\error\\err\{0}\fatal\\errmsg\{1}\id\1\final\", (uint)errorCode, error); client.Send(sendingBuffer); }