예제 #1
0
        private static PacketManager CreatePacketManager()
        {
            PacketManager PacketManager = new PacketManager();

            PacketManager.AddPacket(new IViewNet.Common.Models.Packet(1111, "SetDetectionType", null));
            PacketManager.AddPacket(new IViewNet.Common.Models.Packet(1112, "SetOrientation", null));
            PacketManager.AddPacket(new IViewNet.Common.Models.Packet(1113, "GetDetectedFrame", null));
            PacketManager.AddPacket(new IViewNet.Common.Models.Packet(1114, "SetDetectedFrame", null));
            PacketManager.AddPacket(new IViewNet.Common.Models.Packet(1115, "EndOfFrame", null));
            return(PacketManager);
        }
예제 #2
0
파일: Client.cs 프로젝트: malsbi/IViewNet
        public EstablishConnectionResult Connect(string Host, int Port)
        {
            EstablishConnectionResult Result;

            try
            {
                if (IsEstablished == false)
                {
                    WaitHandler           = new ManualResetEvent(false);
                    EstablishedConnection = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                    EstablishedConnection.BeginConnect(Host, Port, new AsyncCallback(ConnectCallBack), null);
                    WaitHandler.WaitOne();

                    if (IsEstablished)
                    {
                        PacketManager = new PacketManager();
                        PacketManager.AddPacket(new Packet(0000, "SetAuthentication", null));
                        PacketManager.AddPacket(new Packet(0001, "GetAuthentication", null));
                        PacketManager.AddPacket(new Packet(0002, "Synchronize", null));

                        OperationManager = new Operation(EstablishedConnection, Config, PacketManager);
                        AddHandlers(OperationManager);
                        SetOnClientConnect(OperationManager);
                        StartHeartBeat();
                        Result = new EstablishConnectionResult(true, "Client Successfully connected to the server");
                    }
                    else
                    {
                        Result = new EstablishConnectionResult(false, "Client Failed to connect to the server");
                    }
                }
                else
                {
                    Result = new EstablishConnectionResult(false, "Cannot preform 'Connect' operation while the client is connected to the server");
                    ShutdownResult ShutdownResult = Shutdown();
                    if (ShutdownResult.IsOperationSuccess)
                    {
                        Console.WriteLine(ShutdownResult.Message);
                    }
                    else
                    {
                        Console.WriteLine(ShutdownResult.Message);
                    }
                }
            }
            catch (Exception Ex)
            {
                Result = new EstablishConnectionResult(false, "Client Failed to connect to the server");
                SetOnException(Ex);
                IsEstablished = false;
            }
            return(Result);
        }
예제 #3
0
        private void Awake()
        {
            Singleton = this;

            //Adds SyncPacketTable in engine code because it is required for the engine to function.
            PacketManager.AddPacket("SyncPacketTable", 0, PacketManager.SyncPacketTable);

            NetworkManager.Init();
        }
예제 #4
0
파일: Parent.cs 프로젝트: malsbi/PyExecutor
        private PacketManager CreateCommands()
        {
            PacketManager PacketManager = new PacketManager();

            PacketManager.AddPacket(new Packet(1111, "GetAuthentication", null));
            PacketManager.AddPacket(new Packet(2222, "SetAuthentication", null));
            PacketManager.AddPacket(new Packet(3333, "GetStatus", null));
            PacketManager.AddPacket(new Packet(4444, "SetStatus", null));
            PacketManager.AddPacket(new Packet(5555, "SetDetectionType", null));
            PacketManager.AddPacket(new Packet(6666, "GetDetectedFrame", null));
            PacketManager.AddPacket(new Packet(7777, "SetDetectedFrame", null));
            PacketManager.AddPacket(new Packet(8888, "Terminate", null));

            return(PacketManager);
        }
예제 #5
0
 private void LoadHandler()
 {
     PacketManager.AddPacket(0x2001, S2C.SERVER_GLOBAL_MODULE_IDENTIFICATION);
     PacketManager.AddPacket(0xA100, AutoUpdateHandler.SERVER_GATEWAY_PATCH_RESPONSE);
     PacketManager.AddPacket(0xA104, NoticeHandler.SERVER_GATEWAY_NOTICE_RESPONSE);
 }
예제 #6
0
        public static void Init()
        {
            Console.WriteLine("Initializing Packet Table");

            PacketManager.AddPacket("echo", new PacketManager.PacketAction(Echo));
        }
예제 #7
0
        public void Awake()
        {
            Debug.Log("Initializing Packets");

            PacketManager.AddPacket("echo", Echo);
        }