Наследование: RubyBasicSocket
Пример #1
0
 public static RubyArray/*!*/ ReceiveFromNonBlocking(RubyContext/*!*/ context, IPSocket/*!*/ self, int length) {
     bool blocking = self.Socket.Blocking;
     try {
         self.Socket.Blocking = false;
         return ReceiveFrom(context, self, length, null);
     } finally {
         // Reset the blocking
         self.Socket.Blocking = blocking;
     }
 }
Пример #2
0
 public static RubyArray/*!*/ ReceiveFromNonBlocking(ConversionStorage<int>/*!*/ fixnumCast, RubyContext/*!*/ context, IPSocket/*!*/ self, int length, object/*Numeric*/ flags) {
     bool blocking = self.Socket.Blocking;
     try {
         self.Socket.Blocking = false;
         return ReceiveFrom(fixnumCast, context, self, length, flags);
     } finally {
         // Reset the blocking
         self.Socket.Blocking = blocking;
     }
 }
Пример #3
0
 public static RubyArray/*!*/ ReceiveFromNonBlocking(ConversionStorage<int>/*!*/ fixnumCast, IPSocket/*!*/ self, int length) {
     bool blocking = self.Socket.Blocking;
     try {
         self.Socket.Blocking = false;
         return ReceiveFrom(fixnumCast, self, length, null);
     } finally {
         // Reset the blocking
         self.Socket.Blocking = blocking;
     }
 }
Пример #4
0
 public static RubyArray/*!*/ ReceiveFrom(RubyContext/*!*/ context, IPSocket/*!*/ self, int length, object/*Numeric*/ flags) {
     SocketFlags sFlags = ConvertToSocketFlag(context, flags);
     byte[] buffer = new byte[length];
     EndPoint fromEP = new IPEndPoint(IPAddress.Any, 0);
     int received = self.Socket.ReceiveFrom(buffer, sFlags, ref fromEP);
     MutableString str = MutableString.CreateBinary();
     str.Append(buffer, 0, received);
     context.SetObjectTaint(str, true);
     return RubyOps.MakeArray2(str, GetAddressArray(context, fromEP));
 }
Пример #5
0
        public static RubyArray/*!*/ ReceiveFrom(ConversionStorage<int>/*!*/ conversionStorage, IPSocket/*!*/ self, 
            int length, [DefaultParameterValue(null)]object/*Numeric*/ flags) {

            SocketFlags sFlags = ConvertToSocketFlag(conversionStorage, flags);
            byte[] buffer = new byte[length];
            EndPoint fromEP = new IPEndPoint(IPAddress.Any, 0);
            int received = self.Socket.ReceiveFrom(buffer, sFlags, ref fromEP);
            MutableString str = MutableString.CreateBinary();
            str.Append(buffer, 0, received);

            str.IsTainted = true;
            return RubyOps.MakeArray2(str, self.GetAddressArray(fromEP));
        }
Пример #6
0
        public static RubyArray /*!*/ ReceiveFrom(RubyContext /*!*/ context, IPSocket /*!*/ self, int length, object /*Numeric*/ flags)
        {
            SocketFlags sFlags = ConvertToSocketFlag(context, flags);

            byte[]        buffer   = new byte[length];
            EndPoint      fromEP   = new IPEndPoint(IPAddress.Any, 0);
            int           received = self.Socket.ReceiveFrom(buffer, sFlags, ref fromEP);
            MutableString str      = MutableString.CreateBinary();

            str.Append(buffer, 0, received);
            context.SetObjectTaint(str, true);
            return(RubyOps.MakeArray2(str, GetAddressArray(context, fromEP)));
        }
Пример #7
0
 public static object/*!*/ GetPeerAddress(RubyContext/*!*/ context, IPSocket/*!*/ self) {
     return GetAddressArray(context, self.Socket.RemoteEndPoint);
 }
Пример #8
0
 public static RubyArray/*!*/ GetLocalAddress(RubyContext/*!*/ context, IPSocket/*!*/ self) {
     return GetAddressArray(context, self.Socket.LocalEndPoint);
 }
Пример #9
0
        public static RubyArray /*!*/ ReceiveFrom(ConversionStorage <int> /*!*/ conversionStorage, IPSocket /*!*/ self,
                                                  int length, [DefaultParameterValue(null)] object /*Numeric*/ flags)
        {
            SocketFlags sFlags = ConvertToSocketFlag(conversionStorage, flags);

            byte[]        buffer   = new byte[length];
            EndPoint      fromEP   = new IPEndPoint(IPAddress.Any, 0);
            int           received = self.Socket.ReceiveFrom(buffer, sFlags, ref fromEP);
            MutableString str      = MutableString.CreateBinary();

            str.Append(buffer, 0, received);

            var context = conversionStorage.Context;

            str.IsTainted = true;
            return(RubyOps.MakeArray2(str, GetAddressArray(context, fromEP)));
        }
Пример #10
0
 public static object /*!*/ GetPeerAddress(RubyContext /*!*/ context, IPSocket /*!*/ self)
 {
     return(GetAddressArray(context, self.Socket.RemoteEndPoint));
 }
Пример #11
0
 public static RubyArray /*!*/ GetLocalAddress(RubyContext /*!*/ context, IPSocket /*!*/ self)
 {
     return(GetAddressArray(context, self.Socket.LocalEndPoint));
 }
Пример #12
0
        public static RubyArray /*!*/ ReceiveFromNonBlocking(ConversionStorage <int> /*!*/ fixnumCast, IPSocket /*!*/ self, int length)
        {
            bool blocking = self.Socket.Blocking;

            try {
                self.Socket.Blocking = false;
                return(ReceiveFrom(fixnumCast, self, length, null));
            } finally {
                // Reset the blocking
                self.Socket.Blocking = blocking;
            }
        }
Пример #13
0
 public static RubyArray /*!*/ ReceiveFrom(RubyContext /*!*/ context, IPSocket /*!*/ self, int length)
 {
     return(ReceiveFrom(context, self, length, null));
 }
Пример #14
0
 public static RubyArray/*!*/ ReceiveFrom(RubyContext/*!*/ context, IPSocket/*!*/ self, int length) {
     return ReceiveFrom(context, self, length, null);
 }
Пример #15
0
        public static RubyArray /*!*/ ReceiveFromNonBlocking(RubyContext /*!*/ context, IPSocket /*!*/ self, int length, object /*Numeric*/ flags)
        {
            bool blocking = self.Socket.Blocking;

            try {
                self.Socket.Blocking = false;
                return(ReceiveFrom(context, self, length, flags));
            } finally {
                // Reset the blocking
                self.Socket.Blocking = blocking;
            }
        }