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); }
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); }
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(); }
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); }
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); }
public static void Init() { Console.WriteLine("Initializing Packet Table"); PacketManager.AddPacket("echo", new PacketManager.PacketAction(Echo)); }
public void Awake() { Debug.Log("Initializing Packets"); PacketManager.AddPacket("echo", Echo); }