Run() private method

private Run ( ) : void
return void
コード例 #1
0
    void Start()
    {
        leftHandFingers  = new List <Finger>();
        rightHandFingers = new List <Finger>();

        // Find all object at stage with InteractionBehavior script
        List <InteractionBehaviour> interactibleObjects = new List <InteractionBehaviour>();

        Transform[] allStageChildren = stage.GetComponentsInChildren <Transform>();
        foreach (Transform child in allStageChildren)
        {
            InteractionBehaviour childIb = child.GetComponent <InteractionBehaviour>();
            if (childIb != null)
            {
                interactibleObjects.Add(childIb);
            }
        }

        // Fill list of interactible objects
        ilList = new List <InteractibleObject>();
        foreach (InteractionBehaviour ib in interactibleObjects)
        {
            //Debug.Log(ib);
            ilList.Add(new InteractibleObject(this, ib));
        }

        server = new SocketServer(SocketServer.GetLocalIP(), 7999, leftHandFingers, rightHandFingers);
        server.Run();
    }
コード例 #2
0
ファイル: Server.cs プロジェクト: ilikemilktea/PolarisServer
        public void Run()
        {
            while (true)
            {
                // Run the underlying SocketServer
                _server.Run();

                // Check Clients to make sure they still exist
                foreach (var client in Clients)
                {
                    if (client.IsClosed)
                    {
                        Clients.Remove(client);
                        break;
                    }
                }
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: anton-v-ivanov/EchoServer
        static void Main(string[] args)
        {
            ushort port       = DefaultPort;
            var    serverName = DefaultServerName;

            if (args.Length > 1)
            {
                serverName = args[0];

                if (!ushort.TryParse(args[1], out port) || port == 0)
                {
                    Console.WriteLine("Port must be a number between 1 and 65535");
                    Console.Read();
                    return;
                }
            }

            IServer server = new SocketServer();

            server.OnClientConnected    += (roomId, clientId) => Console.WriteLine($"{DateTime.Now.ToLongTimeString()} Client connected. RoomId = {roomId}, ClientId = {clientId}");
            server.OnClientDisconnected += c => Console.WriteLine($"{DateTime.Now.ToLongTimeString()} Client disconnected: {c}");
            server.OnError         += exc => Console.WriteLine($"{DateTime.Now.ToLongTimeString()} Error: {exc.Message}");
            server.OnRoomCreated   += r => Console.WriteLine($"{DateTime.Now.ToLongTimeString()} Room created: {r}");
            server.OnRoomDestroyed += r => Console.WriteLine($"{DateTime.Now.ToLongTimeString()} Room destroyed: {r}");
            //server.OnMessageReceived += (roomId, clientId, text) => Console.WriteLine($"{DateTime.Now.ToLongTimeString()} Message received. RoomId = {roomId}, ClientId = {clientId}, Text = {text}");

            try
            {
                server.Run(serverName, port);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            Console.WriteLine($"Server started on {serverName}:{port}");



            Console.WriteLine("Press any key to exit");
            Console.Read();
            server.Stop();
        }
コード例 #4
0
 static void Main(string[] args)
 {
     if (args.Length == 0)
     {
         Console.WriteLine("Please input comand:client or server");
         return;
     }
     if (args[0].ToLower() == "server")
     {
         SocketServer server = new SocketServer(System.Net.IPAddress.Parse("127.0.0.1"), 10086);
         server.Run();
     }
     else if (args[0].ToLower() == "client")
     {
         RunClient();
     }
     else
     {
         Console.WriteLine("Band command line.");
     }
 }