Inheritance: RubyBasicSocket
Example #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;
     }
 }
Example #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;
     }
 }
Example #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;
     }
 }
Example #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));
 }
Example #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));
        }
Example #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)));
        }
Example #7
0
 public static object/*!*/ GetPeerAddress(RubyContext/*!*/ context, IPSocket/*!*/ self) {
     return GetAddressArray(context, self.Socket.RemoteEndPoint);
 }
Example #8
0
 public static RubyArray/*!*/ GetLocalAddress(RubyContext/*!*/ context, IPSocket/*!*/ self) {
     return GetAddressArray(context, self.Socket.LocalEndPoint);
 }
Example #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)));
        }
Example #10
0
 public static object /*!*/ GetPeerAddress(RubyContext /*!*/ context, IPSocket /*!*/ self)
 {
     return(GetAddressArray(context, self.Socket.RemoteEndPoint));
 }
Example #11
0
 public static RubyArray /*!*/ GetLocalAddress(RubyContext /*!*/ context, IPSocket /*!*/ self)
 {
     return(GetAddressArray(context, self.Socket.LocalEndPoint));
 }
Example #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;
            }
        }
Example #13
0
 public static RubyArray /*!*/ ReceiveFrom(RubyContext /*!*/ context, IPSocket /*!*/ self, int length)
 {
     return(ReceiveFrom(context, self, length, null));
 }
Example #14
0
 public static RubyArray/*!*/ ReceiveFrom(RubyContext/*!*/ context, IPSocket/*!*/ self, int length) {
     return ReceiveFrom(context, self, length, null);
 }
Example #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;
            }
        }