Inheritance: IOHandler
コード例 #1
0
ファイル: UDPCarrier.cs プロジェクト: zhujingcheng/csharprtmp
        public static UDPCarrier Create(string bindIp, int bindPort)
        {
            var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);

            //3. bind if necessary
            if (bindIp != "")
            {
                socket.Bind(new IPEndPoint(IPAddress.Parse(bindIp), bindPort));
            }

            //4. Create the carrier
            var pResult = new UDPCarrier(socket);

            return(pResult);
        }
コード例 #2
0
ファイル: UDPCarrier.cs プロジェクト: zhujingcheng/csharprtmp
        public static UDPCarrier Create(string bindIp, ushort bindPort, BaseProtocol pProtocol)
        {
            if (pProtocol == null)
            {
                Logger.FATAL("Protocol can't be null");
                return(null);
            }

            UDPCarrier pResult = Create(bindIp, bindPort);

            if (pResult == null)
            {
                Logger.FATAL("Unable to create UDP carrier");
                return(null);
            }

            pResult.Protocol = pProtocol.FarEndpoint;
            pProtocol.FarEndpoint.IOHandler = pResult;

            return(pResult);
        }
コード例 #3
0
ファイル: UDPCarrier.cs プロジェクト: langhuihui/csharprtmp
 public static UDPCarrier Create(string bindIp, int bindPort)
 {
     var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
     //3. bind if necessary
     if (bindIp != "")
     {
         socket.Bind(new IPEndPoint(IPAddress.Parse(bindIp), bindPort));
     }
     
     //4. Create the carrier
     var pResult = new UDPCarrier(socket);
     return pResult;
 }