Beispiel #1
0
    void OnClientConnect(System.IAsyncResult result)
    {
        Debug.Log("Handling client connecting");

        try
        {
            //gameObject.SendMessage ("OnClientConnected", socket.EndAccept (result));
            Debug.Log("Client connected");
            Socket client = socket.EndAccept(result);
            clients.Add(client);
            SocketRead.Begin(client, OnReceive, OnReceiveError);
        }
        catch (System.Exception e)
        {
            Debug.Log("Exception when accepting incoming connection: " + e);
            Debug.LogError("Exception when accepting incoming connection: " + e);
        }

        try
        {
            socket.BeginAccept(new System.AsyncCallback(OnClientConnect), socket);
        }
        catch (System.Exception e)
        {
            Debug.LogError("Exception when starting new accept process: " + e);
        }
    }
    void OnClientStarted(Socket socket)
    {
        Debug.Log("Client started");

        this.socket = socket;
        SocketRead.Begin(socket, OnReceive, OnError);
    }
    public void Update()
    {
        if (OnClientConnectResult != null)
        {
            mSocketDebug.DebugLog("lServer: Handling client connecting");
            try
            {
                Socket client = mSocket.EndAccept(OnClientConnectResult);

                mSocketDebug.DebugLog("lServer: Client connected");
                mClients.Add(client);
                SocketRead.Begin(client, OnReceive, OnReceiveError);
                OnClientConnectResult = null;
            }
            catch (System.Exception e)
            {
                mSocketDebug.DebugLogError("lServer: Exception when accepting incoming connection: " + e);
            }

            try
            {
                mSocket.BeginAccept(new System.AsyncCallback(OnClientConnect), mSocket);
            }
            catch (System.Exception e)
            {
                mSocketDebug.DebugLogError("lServer: Exception when starting new accept process: " + e);
            }
        }

        if (mBatchedContent.Count > 0)
        {
            foreach (JSONData transaction in mBatchedContent)
            {
                Debug.Log(transaction.ToString());
            }

            while (mBatchedContent.Count > 0)
            {
                mBatchedContent.Remove(0);
            }
        }
    }
Beispiel #4
0
 void OnClientConnected(Socket client)
 {
     Debug.Log("Client connected");
     clients.Add(client);
     SocketRead.Begin(client, OnReceive, OnReceiveError);
 }
Beispiel #5
0
 public void OnClientStartedTouch(Socket socket)
 {
     //  Debug.Log("CLient Touch started");
     this.socketTouch = socket;
     SocketRead.Begin(socket, OnReceive, OnError);
 }
Beispiel #6
0
 public void OnClientStartedAnswer(Socket socket)
 {
     //  Debug.Log("CLient Answer started");
     this.socketAnswer = socket;
     SocketRead.Begin(socket, OnReceive, OnError);
 }