Пример #1
0
 /// <summary>
 /// Handler for Disconnected Event.
 /// </summary>
 /// <param name="iSource"></param>
 /// <param name="iArgs"></param>
 static void OnDisconnected(object iSource, EventArgs iArgs)
 {
     GMutex.WaitOne();
     Console.WriteLine();
     Console.WriteLine(DateTime.Now.TimeOfDay + ": INFO: Disconnected from server.");
     GMutex.ReleaseMutex();
 }
Пример #2
0
 /// <summary>
 /// Handler for Socket Error Event.
 /// </summary>
 /// <param name="iSource"></param>
 /// <param name="iArgs"></param>
 static void OnSocketError(object iSource, SocketErrorEventArgs iArgs)
 {
     GMutex.WaitOne();
     Console.WriteLine();
     Console.WriteLine(DateTime.Now.TimeOfDay + ": WARN: Socket Status: {0}, Error: {1}", iArgs.Status, iArgs.Error);
     GMutex.ReleaseMutex();
 }
Пример #3
0
 /// <summary>
 /// Handler for Connected Event.
 /// </summary>
 /// <param name="iSource"></param>
 /// <param name="iArgs"></param>
 static void OnConnected(object iSource, EventArgs iArgs)
 {
     GMutex.WaitOne();
     Console.WriteLine();
     Console.WriteLine(DateTime.Now.TimeOfDay + ": INFO: Connection accepted.");
     GMutex.ReleaseMutex();
 }
Пример #4
0
        /// <summary>
        /// Handler for Response Event.
        /// </summary>
        /// <param name="iSource"></param>
        /// <param name="iArgs"></param>
        static void OnResponse(object iSource, ResponseEventArgs iArgs)
        {
            GMutex.WaitOne();
            Console.WriteLine();
            Console.WriteLine(DateTime.Now.TimeOfDay + ": INFO: Response:");
            DumpBytes(iArgs.ResponseBuffer, 0, iArgs.ResponseBuffer.Length);

            if (iArgs.DataBuffer != null)
            {
                Console.WriteLine();
                Console.WriteLine(DateTime.Now.TimeOfDay + ": INFO: Data:", iArgs.DataBuffer.Length);
                DumpBytes(iArgs.DataBuffer, 0, iArgs.DataBuffer.Length);
            }

            Console.WriteLine(DateTime.Now.TimeOfDay + ": INFO: Response, Total of {0} byte/s", iArgs.ResponseBuffer.Length);
            if (iArgs.DataBuffer != null)
            {
                Console.WriteLine(DateTime.Now.TimeOfDay + ": INFO: Data, Total of {0} byte/s", iArgs.DataBuffer.Length);
            }

            GMutex.ReleaseMutex();
        }