Example #1
0
 private void OnSentToClient(bool success, ISocketClientToken client)
 {
     if (success)
     {
         Debug.Log(string.Format("<color=red>Sent to client({0})</color>", client.ID));
     }
 }
Example #2
0
    private void OnClientConnected(ISocketClientToken client)
    {
        Debug.Log(string.Format("<color=red>Client({0}) connected. Connected clients: {1}</color>", client.ID,
                                _server.Clients.Count));
        client.Send(Encoding.UTF8.GetBytes("welcome"));

        /*try
         * {
         *  GameObject.CreatePrimitive(PrimitiveType.Cube); //should be called from main thread
         * }
         * catch (Exception ex)
         * {
         *  Debug.LogException(ex);
         * }*/
    }
Example #3
0
 private void OnClientDisconnected(ISocketClientToken client)
 {
     Debug.Log(string.Format("<color=red>Client({0}) disconnected. Connected clients: {1}</color>", client.ID,
                             _server.Clients.Count));
 }
Example #4
0
 private void OnReceivedFromClient(ISocketClientToken client, byte[] message)
 {
     Debug.Log(string.Format("<color=red>Received from client({0}): {1}</color>", client.ID,
                             Encoding.UTF8.GetString(message)));
 }