Esempio n. 1
0
        public static FFAcceptor Listen(string host, SocketMsgHandler funcMsg, SocketBrokenHandler funcBroken)
        {
            string[] strList = host.Split(":");
            if (strList.Length != 3)
            {
                return(null);
            }
            string ip = strList[1];

            string[] ipList = ip.Split("//");
            if (ipList.Length == 2)
            {
                ip = ipList[1];
            }
            else
            {
                ip = ipList[0];
            }

            int        port       = int.Parse(strList[2]);
            SocketCtrl ctrl       = new SocketCtrl(funcMsg, funcBroken);
            FFAcceptor ffacceptor = new FFAcceptor(ctrl);

            if (ffacceptor.Listen(ip, port))
            {
                return(ffacceptor);
            }
            return(null);
        }