Beispiel #1
0
        private void CmdSendReceiver()
        {
            try
            {
                InterceptRequest req = new InterceptRequest() { cmd = 0, extnum = string.Empty };
                InterceptResponse res;
                int count = 0;

                while (IsSockCmdSrvStarted)
                {
                    byte[] bytes = util.ObjectToByteArray(req);

                    count = 0;
                    count = sockCmdSrv.ReceiveFrom(bytes, SocketFlags.None, ref remoteepCmd);

                    if (count == 0) return;

                    req = util.ByteArrayToObject<InterceptRequest>(bytes);

                    switch (req.cmd)
                    {
#if false
                        case 1:
                            // 내선 전화 상태 요청
                            __res = new InterceptResponse() { cmd = __req.cmd, result = 1, innertels = _innertelstatus };
                            //__bytes = util.GetBytes(__res);
                            __bytes = util.ObjectToByteArray(__res);
                            __count = _sockCmdSrv.SendTo(__bytes, _remoteepCmd);
                            break;
#endif
                        case 2:
                            // RTP Redirect 요청
                            res = new InterceptResponse() { cmd = req.cmd, result = 1 };
                            bytes = util.ObjectToByteArray(res);
                            count = sockCmdSrv.SendTo(bytes, remoteepCmd);
                            break;
                        case 3:
                            // RTP Redirect 해제 요청
                            res = new InterceptResponse() { cmd = req.cmd, result = 1 };
                            bytes = util.ObjectToByteArray(res);
                            count = sockCmdSrv.SendTo(bytes, remoteepCmd);
                            break;
                        case 4:
                            // 파일 Stream 요청
                            res = new InterceptResponse() { cmd = req.cmd, result = 1 };
                            bytes = util.ObjectToByteArray(res);
                            count = sockCmdSrv.SendTo(bytes, remoteep);
                            break;
                        case 5:
                            // 파일 Down 요청
                            res = new InterceptResponse() { cmd = req.cmd, result = 1 };
                            bytes = util.ObjectToByteArray(res);
                            count = sockCmdSrv.SendTo(bytes, remoteep);
                            break;
                    }
                }
            }
            catch (SocketException se)
            {
                throw se;
            }
        }
Beispiel #2
0
        private void CmdSendReceiver()
        {
            try
            {
                InterceptRequest req = new InterceptRequest()
                {
                    cmd = 0, extnum = string.Empty
                };
                InterceptResponse res;
                int count = 0;

                while (IsSockCmdSrvStarted)
                {
                    byte[] bytes = util.ObjectToByteArray(req);

                    count = 0;
                    count = sockCmdSrv.ReceiveFrom(bytes, SocketFlags.None, ref remoteepCmd);

                    if (count == 0)
                    {
                        return;
                    }

                    req = util.ByteArrayToObject <InterceptRequest>(bytes);

                    switch (req.cmd)
                    {
#if false
                    case 1:
                        // 내선 전화 상태 요청
                        __res = new InterceptResponse()
                        {
                            cmd = __req.cmd, result = 1, innertels = _innertelstatus
                        };
                        //__bytes = util.GetBytes(__res);
                        __bytes = util.ObjectToByteArray(__res);
                        __count = _sockCmdSrv.SendTo(__bytes, _remoteepCmd);
                        break;
#endif
                    case 2:
                        // RTP Redirect 요청
                        res = new InterceptResponse()
                        {
                            cmd = req.cmd, result = 1
                        };
                        bytes = util.ObjectToByteArray(res);
                        count = sockCmdSrv.SendTo(bytes, remoteepCmd);
                        break;

                    case 3:
                        // RTP Redirect 해제 요청
                        res = new InterceptResponse()
                        {
                            cmd = req.cmd, result = 1
                        };
                        bytes = util.ObjectToByteArray(res);
                        count = sockCmdSrv.SendTo(bytes, remoteepCmd);
                        break;

                    case 4:
                        // 파일 Stream 요청
                        res = new InterceptResponse()
                        {
                            cmd = req.cmd, result = 1
                        };
                        bytes = util.ObjectToByteArray(res);
                        count = sockCmdSrv.SendTo(bytes, remoteep);
                        break;

                    case 5:
                        // 파일 Down 요청
                        res = new InterceptResponse()
                        {
                            cmd = req.cmd, result = 1
                        };
                        bytes = util.ObjectToByteArray(res);
                        count = sockCmdSrv.SendTo(bytes, remoteep);
                        break;
                    }
                }
            }
            catch (SocketException se)
            {
                throw se;
            }
        }