Exemplo n.º 1
0
        void WithSockets(UnixAddressFamily af, UnixSocketType type, UnixSocketProtocol protocol, Action <int, int> f)
        {
            int so1, so2;

            if ((so1 = Syscall.socket(af, type, protocol)) < 0)
            {
                UnixMarshal.ThrowExceptionForLastError();
            }
            try {
                if ((so2 = Syscall.socket(af, type, protocol)) < 0)
                {
                    UnixMarshal.ThrowExceptionForLastError();
                }
                try {
                    SetTimeout(so1);
                    SetTimeout(so2);

                    f(so1, so2);
                } finally {
                    if (Syscall.close(so2) < 0)
                    {
                        UnixMarshal.ThrowExceptionForLastError();
                    }
                }
            } finally {
                if (Syscall.close(so1) < 0)
                {
                    UnixMarshal.ThrowExceptionForLastError();
                }
            }
        }
Exemplo n.º 2
0
        public static Int32 FromUnixSocketType(UnixSocketType value)
        {
            Int32 rval;

            if (FromUnixSocketType(value, out rval) == -1)
            {
                ThrowArgumentException(value);
            }
            return(rval);
        }
Exemplo n.º 3
0
		void WithSockets (UnixAddressFamily af, UnixSocketType type, UnixSocketProtocol protocol, Action<int, int> f)
		{
			int so1, so2;
			if ((so1 = Syscall.socket (af, type, protocol)) < 0)
				UnixMarshal.ThrowExceptionForLastError ();
			try {
				if ((so2 = Syscall.socket (af, type, protocol)) < 0)
					UnixMarshal.ThrowExceptionForLastError ();
				try {
					SetTimeout (so1);
					SetTimeout (so2);

					f (so1, so2);
				} finally {
					if (Syscall.close (so2) < 0)
						UnixMarshal.ThrowExceptionForLastError ();
				}
			} finally {
				if (Syscall.close (so1) < 0)
					UnixMarshal.ThrowExceptionForLastError ();
			}
		}
Exemplo n.º 4
0
		public static bool TryToUnixSocketType (Int32 value, out UnixSocketType rval)
		{
			return ToUnixSocketType (value, out rval) == 0;
		}
Exemplo n.º 5
0
		private static extern int ToUnixSocketType (Int32 value, out UnixSocketType rval);
Exemplo n.º 6
0
		public static Int32 FromUnixSocketType (UnixSocketType value)
		{
			Int32 rval;
			if (FromUnixSocketType (value, out rval) == -1)
				ThrowArgumentException (value);
			return rval;
		}
Exemplo n.º 7
0
		public static bool TryFromUnixSocketType (UnixSocketType value, out Int32 rval)
		{
			return FromUnixSocketType (value, out rval) == 0;
		}
Exemplo n.º 8
0
		private static extern int FromUnixSocketType (UnixSocketType value, out Int32 rval);
Exemplo n.º 9
0
 public static bool TryToUnixSocketType(Int32 value, out UnixSocketType rval)
 {
     return(ToUnixSocketType(value, out rval) == 0);
 }
Exemplo n.º 10
0
 private static extern int ToUnixSocketType(Int32 value, out UnixSocketType rval);
Exemplo n.º 11
0
 public static bool TryFromUnixSocketType(UnixSocketType value, out Int32 rval)
 {
     return(FromUnixSocketType(value, out rval) == 0);
 }
Exemplo n.º 12
0
 private static extern int FromUnixSocketType(UnixSocketType value, out Int32 rval);