Inheritance: IPSocket
示例#1
0
        public static int Connect(ConversionStorage<MutableString>/*!*/ stringCast, ConversionStorage<int>/*!*/ fixnumCast, 
            RubyContext/*!*/ context, UDPSocket/*!*/ self, object hostname, object port) {

            string strHostname = ConvertToHostString(stringCast, context, hostname);
            int iPort = ConvertToPortNum(stringCast, fixnumCast, context, port);
            self.Socket.Connect(strHostname, iPort);
            return 0;
        }
示例#2
0
 public static int Bind(RubyContext/*!*/ context, UDPSocket/*!*/ self, object hostname, object port) {
     int iPort = ConvertToPortNum(context, port);
     if (hostname == null) {
         hostname = MutableString.Create("localhost");
     }
     MutableString address = GetAddressInternal(context, hostname);
     IPEndPoint ep = new IPEndPoint(IPAddress.Parse(address.ConvertToString()), iPort);
     self.Socket.Bind(ep);
     return 0;
 }
示例#3
0
        public static int Bind(ConversionStorage<MutableString>/*!*/ stringCast, ConversionStorage<int>/*!*/ fixnumCast, 
            RubyContext/*!*/ context, UDPSocket/*!*/ self, object hostNameOrAddress, object port) {

            int iPort = ConvertToPortNum(stringCast, fixnumCast, context, port);
            IPAddress address = (hostNameOrAddress != null) ? 
                GetHostAddress(ConvertToHostString(stringCast, context, hostNameOrAddress)) : IPAddress.Loopback;

            IPEndPoint ep = new IPEndPoint(address, iPort);
            self.Socket.Bind(ep);
            return 0;
        }
示例#4
0
        public static UDPSocket/*!*/ Reinitialize(ConversionStorage<MutableString>/*!*/ stringCast, ConversionStorage<int>/*!*/ fixnumCast,
            UDPSocket/*!*/ self, [DefaultParameterValue(null)]object family) {

            self.Socket = CreateSocket(ConvertToAddressFamily(stringCast, fixnumCast, family));
            return self;
        }
示例#5
0
 public static int Connect(RubyContext/*!*/ context, UDPSocket/*!*/ self, object hostname, object port) {
     MutableString strHostname = ConvertToHostString(context, hostname);
     int iPort = ConvertToPortNum(context, port);
     self.Socket.Connect(strHostname.ConvertToString(), iPort);
     return 0;
 }
示例#6
0
 public static UDPSocket /*!*/ Reinitialize(ConversionStorage <MutableString> /*!*/ stringCast, ConversionStorage <int> /*!*/ fixnumCast,
                                            UDPSocket /*!*/ self, [DefaultParameterValue(null)] object family)
 {
     self.Socket = CreateSocket(ConvertToAddressFamily(stringCast, fixnumCast, family));
     return(self);
 }