Пример #1
0
        public static int GetInt(int socket, SocketOptionLevel level, SocketOption opts)
        {
            int value = 0, size = sizeof(int);
            int result = Interop.nn_getsockopt(socket, (int)level, (int)opts, ref value, ref size);

            if (result != 0)
            {
                throw new NanomsgException(string.Format("nn_getsockopt {0}", opts));
            }
            return(value);
        }
Пример #2
0
        public static int GetSockOpt(int s, Protocol level, int option, out int val)
        {
            int optvallen = sizeof(int);
            int optval    = 0;

            int rc = Interop.nn_getsockopt(s, (int)level, option, ref optval, ref optvallen);

            val = optval;

            return(rc);
        }
Пример #3
0
        public static TimeSpan?GetTimespan(int socket, SocketOptionLevel level, SocketOption opts)
        {
            int value = 0, size = sizeof(int);
            int result = Interop.nn_getsockopt(socket, (int)level, (int)opts, ref value, ref size);

            if (result != 0)
            {
                throw new NanomsgException(string.Format("nn_getsockopt {0}", opts));
            }
            return(value < 0 ? (TimeSpan?)null : TimeSpan.FromMilliseconds(value));
        }
Пример #4
0
        public static int GetSockOpt(int s, SocketOption option, out int val)
        {
            int optvallen = sizeof(int);
            int optval    = 0;

            int rc = Interop.nn_getsockopt(s, Constants.NN_SOL_SOCKET, (int)option, ref optval, ref optvallen);

            val = optval;

            return(rc);
        }