1234567891011121314151617181920212223242526272829303132333435363738394041 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class ServerExample : MonoBehaviour {
- //public Text text_ip;
- //public InputField text_send;
- //public Text text_receive;
- private Tcp_Server ts;
- // Use this for initialization
- void Start () {
-
- ts = GetComponent<Tcp_Server> ();
- //Debug.Log (Tcp_Util.GetAddressIP () + "");
- //text_ip.text = Tcp_Util.GetAddressIP () + "";
- onStartUp ();
- }
-
- // Update is called once per frame
- void Update()
- {
- }
- public void onStartUp()
- {
- ts.StartUp ();
- }
- public void send(MessageData msg)
- {
- byte[] bytes = Tcp_Util.MessageToBuffer (msg);
- //byte[] bytes = Tcp_Util.StringToBytes (text_send.text);
- //text_send.text = "";
- ts.SendAll (bytes);
- }
- }
|