void OnGUI() { editString = GUI.TextField(new Rect(10, 10, 100, 20), editString); GUI.Label(new Rect(10, 30, 300, 20), tcpClient.GetRecvStr()); if (GUI.Button(new Rect(10, 50, 60, 20), "send")) { tcpClient.SocketSend(editString); } }
private void init() { //StopAllCoroutines(); //StartCoroutine("UpdateCoutine"); tcpClient.SocketSend("1"); string temp = tcpClient.GetRecvStr(); string[] temps = temp.Split(';'); NodeCode.text = "节点编号:" + temps[0]; //GUI.Label(new Rect(10,70,300,20),"节点编号:"+tcpClient.GetRecvStr()); tcpClient.SocketSend("2"); LightStrength.text = "当前光强:" + temps[1]; //GUI.Label(new Rect(10,90,300,20),"当前光强:"+tcpClient.GetRecvStr()); }
public void send(string data) { client.SocketSend(protocol_begin.ToString()); client.SocketSend(data); client.SocketSend(protocol_end.ToString()); }