Example #1
0
        public void Start()
        {
            IPAddress[] addrs = Dns.GetHostAddresses(URL);
            if (addrs.Length > 0)
            {
                endp = new IPEndPoint(addrs[0], Port);
                #if UNITY_WEBPLAYER
                if (!Security.PrefetchSocketPolicy(addrs[0].ToString(), Port, 3000))
                {
                    Debugger.LogError("Get Socket Polily Failed");
                    return;
                }
                #endif
                socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                sm.StartCoroutine(ConnectFrame(socket, endp));
            }

            lastProto       = new Pair <int, Stream>();
            lastProto.first = -1;
            Coo.packetManager.AddCallback <S_ReConnect_0x101>(S_ReConnect_0x101);
        }