Example #1
0
 protected virtual void OnMessageEvent(SoketEventArgs e)
 {
     if (OnMessage != null)
     {
         OnMessage(this, e);
     }
 }
Example #2
0
        protected virtual void OnReceiveMessage(SoketEventArgs e)
        {
            EventHandler <SoketEventArgs> handler = MessageEvent;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Example #3
0
        public void CheckRecvMsg(byte[] RecvData, int i_recvSize)
        {
            byte[] tempRecv = RecvData.Take(i_recvSize).ToArray();
            string sData    = Encoding.UTF8.GetString(tempRecv);

            SoketEventArgs args = new SoketEventArgs();

            args.EventTime    = DateTime.Now;
            args.Message      = sData;
            args.ProtocolType = Client.ProtocolType.ToString();
            args.EndPoint     = ep.ToString();

            OnMessageEvent(args);
        }
Example #4
0
        private void CheckRecvMsg(byte[] recvByte, int i_recv)
        {
            byte[] tempRecv = RecvData.Take(i_recv).ToArray(); // 전체 바이트에서 실제로 수신된 바이트만 따로 골라낸다
            string sData    = Encoding.UTF8.GetString(tempRecv);
            //Console.WriteLine(sData);

            SoketEventArgs args = new SoketEventArgs();

            args.EventTime    = DateTime.Now;
            args.Message      = sData;
            args.ProtocolType = Server.ProtocolType.ToString();
            args.EndPoint     = ep.ToString();

            OnMessageEvent(args);
            OnReceiveMessage(args);
        }
Example #5
0
        static void OnReceiveMeaasge(object sender, SoketEventArgs e)
        {
            log.Info(string.Format("[{0}][{1}]{2}"
                                   , e.ProtocolType, e.EndPoint, e.Message));

            string sReplyMessage = sExcuteCmd(e.Message.ToUpper());

            if (sReplyMessage.Equals(string.Empty) == false)
            {
                switch (e.ProtocolType.ToUpper())
                {
                case "TCP":
                    string[] EndPoint = e.EndPoint.Split(':');
                    //tcpConnect.SendMessage(EndPoint[0], EndPoint[1], sReplyMessage);

                    break;

                case "UDP":
                    udpServer.SendResponse(Encoding.UTF8.GetBytes(sReplyMessage));
                    break;
                }
            }
        }
Example #6
0
 static void client_OnMessageEvent(object sender, SoketEventArgs e)
 {
     log.Info(string.Format("[{0}][{1}]{2}", e.ProtocolType, e.EndPoint, e.Message));
 }