Unity3d BeginConnect 传递参数
< 返回列表时间: 2014-04-06来源:OSCHINA
public void SendMessage (System.Object param) { try { //这是一个异步的建立连接,当连接建立成功时调用connectCallback方法 clientSocket.BeginConnect (ipAddress, hostPort, new AsyncCallback (connectCallback), param); } catch (Exception ex) { Debug.Log (ex.ToString ()); } } private void connectCallback (IAsyncResult asyncConnect) { if (!clientSocket.Connected) { closeSocket (); } else { clientSocket.EndConnect (asyncConnect); businessComm (asyncConnect.AsyncState); } }

热门排行