static void Main(string[] args) { Console.WriteLine("Hello World!"); tcpServer t = new tcpServer(); t.listen(); }
private void tcpServer1_OnDataAvailable(tcpServer.TcpServerConnection connection) { byte[] data = readStream(connection.Socket); //Console.WriteLine ("data Length :"+data.Length); var pf = (StrPacketFormate)DataPacket.RawDeserialize(data, typeof(StrPacketFormate)); if (!verifyMd5Hash(data.Skip(24).Take(data.Length - 24).ToArray(), pf.CheckSum)) Console.WriteLine("CheckSum Failed"); if (!verifySeqNo(IPAddress.HostToNetworkOrder(pf.SequenceNumber))) Console.WriteLine("SequenceNumber Failed"); iccount.Invoke(); if (data != null) { SIGN_ON_REQUEST_OUT(data); // string dataStr = Encoding.ASCII.GetString(data); //invokeDelegate del = () => //{ // logData(false, dataStr); //}; //Invoke(del); data = null; } }
private void tcpServer1_OnConnect(tcpServer.TcpServerConnection connection) { iccount.Invoke(); Console.WriteLine("Server Connect Successfully . \n Continue.."); //invokeDelegate setText = () => lblConnected.Text = tcpServer1.Connections.Count.ToString(); //Invoke(setText); }
private void tcpServer1_OnDataAvailable(tcpServer.TcpServerConnection connection) { byte[] data = readStream(connection.Socket); if (data != null) { string dataStr = Encoding.ASCII.GetString(data); invokeDelegate del = () => { logData(false, dataStr); }; Invoke(del); data = null; } }
private void tcpServer1_OnConnect(tcpServer.TcpServerConnection connection) { invokeDelegate setText = () => lblConnected.Text = tcpServer1.Connections.Count.ToString(); Invoke(setText); }
private void tcpServer1_OnConnect(tcpServer.TcpServerConnection connection) { invokeDelegate setText = () => lblConnected.Text = tcpServer1.Connections.Count.ToString(); Invoke(setText); while (tcpServer1.Connections.Count != 0) { toolStripStatusLabel4.Text = "Connection: 1 !"; toolStripStatusLabel4.BackColor = Color.Lime; } }
static ManualResetEvent resetEvent_; // blocking event // main static void Main(string[] args) { resetEvent_ = new ManualResetEvent(false); // Blocks until Set() is called tcpServer p = new tcpServer(10001); resetEvent_.WaitOne(); }