예제 #1
0
        void OnGUI()
        {
            int firstclient = server.connections.Count > 0 ? server.connections.First().Key : -1;

            GUILayout.BeginArea(new Rect(160, 5, 250, 400));
            GUILayout.Label("Server:");
            if (GUILayout.Button("Start"))
            {
                server.Start(Port);
            }
            if (GUILayout.Button("Send 0x01, 0x02 to " + firstclient))
            {
                server.Send(firstclient, new ArraySegment <byte>(new byte[] { 0x01, 0x02 }), KcpChannel.Reliable);
            }
            if (GUILayout.Button("Send 0x03, 0x04 to " + firstclient + " unreliable"))
            {
                server.Send(firstclient, new ArraySegment <byte>(new byte[] { 0x03, 0x04 }), KcpChannel.Unreliable);
            }
            if (GUILayout.Button("Disconnect connection " + firstclient))
            {
                server.Disconnect(firstclient);
            }
            if (GUILayout.Button("Stop"))
            {
                server.Stop();
            }
            GUILayout.EndArea();
        }
예제 #2
0
 // kick and give it enough time to handle
 void KickClientBlocking(int connectionId)
 {
     server.Disconnect(connectionId);
     UpdateSeveralTimes();
 }
예제 #3
0
 public override bool ServerDisconnect(int connectionId)
 {
     server.Disconnect(connectionId);
     return(true);
 }