/* * private void ReceiveAllTime() * { * Debug.Log("ReceiveAllTime"); * if (Connected && connected) * { * try * { * int dataLength = 0; * dataLength = socket.Available; * * if (dataLength != 0) * { * var dataBuffer = new byte[dataLength]; * socket.Receive(dataBuffer); * bgISocket.receiveData(dataBuffer); * } * } * catch (Exception e) * { * Debug.LogWarning(e.ToString()); * Debug.LogWarning("ReceiveAllTime Disconnect"); * if (connected) disconnect(); * } * } * } */ public void onUpdate(float delta) { //if (socketReceiveThread == null) ReceiveAllTime(); if (state > BGSocketState.idle) { switch (state) { case BGSocketState.connected: connected = true; bgISocket.socketConnected(); break; case BGSocketState.disconnected: Debug.Log("#@@$$BGSocketState.disconnected"); bgISocket.scoketDiconnected(); break; case BGSocketState.received: break; } state = BGSocketState.idle; if (connected && connected != Connected) { Debug.LogWarning("Where socket disconned not send by function???"); if (bgISocket != null) { bgISocket.scoketDiconnected(); } } } }
public void checkConnected() { if (Connected) { checkcall = null; bgISocket.socketConnected(); } else { checkcall = FrameDelayCall.Add(checkConnected, 5, bgISocket as MonoBehaviour, true); } }