Example #1
0
        public virtual int GetInt32(string name)
        {
            var value = default(int);

            DefaultInvoker.InvokeWithDefaultErrorHandling(() => _getInt32(name, ref value));
            return(value);
        }
Example #2
0
        public virtual double GetTotalMilliseconds(string name)
        {
            var value = default(int);

            DefaultInvoker.InvokeWithDefaultErrorHandling(() => _getDurationMilliseconds(name, ref value));
            return(value);
        }
Example #3
0
        public virtual ulong GetSize(string name)
        {
            var value = default(ulong);

            DefaultInvoker.InvokeWithDefaultErrorHandling(() => _getUInt64(name, ref value));
            return(value);
        }
Example #4
0
        public void Dial(string addr, Dialer d, SocketFlag flags = None)
        {
            var did = default(uint);

            DefaultInvoker.InvokeWithDefaultErrorHandling(() => __Dial(_sid, addr, ref did, (int)flags));
            d?.OnDialed(did);
        }
Example #5
0
        public void Listen(string addr, Listener l, SocketFlag flags = None)
        {
            var lid = default(uint);

            DefaultInvoker.InvokeWithDefaultErrorHandling(() => __Listen(_sid, addr, ref lid, (int)flags));
            l?.OnListened(lid);
        }
Example #6
0
        public virtual bool TryReceive(Message message, SocketFlag flags = None)
        {
            var msgPtr = IntPtr.Zero;

            DefaultInvoker.InvokeWithDefaultErrorHandling(() => __ReceiveMessage(_sid, out msgPtr, (int)flags));
            message.RetainPtr(msgPtr);
            return(message.HasOne);
        }
Example #7
0
 public virtual void Start(SocketFlag flags = None)
 {
     if (HasOne)
     {
         return;
     }
     DefaultInvoker.InvokeWithDefaultErrorHandling(() => _start((int)flags));
 }
Example #8
0
 public virtual void Close()
 {
     if (!HasOne)
     {
         return;
     }
     DefaultInvoker.InvokeWithDefaultErrorHandling(() => _close());
 }
Example #9
0
        public virtual bool TryReceive(ICollection <byte> buffer, ref int count, SocketFlag flags = None)
        {
            var local = new byte[count];
            var sz    = (ulong)count;

            DefaultInvoker.InvokeWithDefaultErrorHandling(() => __Receive(_sid, local, ref sz, (int)flags));
            buffer.AddRange(local.Take(count = (int)sz));
            return(sz > 0);
        }
Example #10
0
 public void Close()
 {
     if (!HasOne)
     {
         return;
     }
     DefaultInvoker.InvokeWithDefaultErrorHandling(() => __Close(_sid));
     Configure(_sid = 0);
 }
Example #11
0
        public virtual string GetText(string name, ref ulong length)
        {
            var sz = length;
            var sb = new StringBuilder((int)length);

            DefaultInvoker.InvokeWithDefaultErrorHandling(() => _getStringBuilder(name, sb, ref sz));
            var s = sb.ToString().Trim();

            length = (ulong)s.LongCount();
            return(s);
        }
Example #12
0
 public virtual void Send(Message message, SocketFlag flags = None)
 {
     DefaultInvoker.InvokeWithDefaultErrorHandling(() => __SendMessage(_sid, message.CedePtr(), (int)flags));
 }
Example #13
0
 protected Socket(OpenDelegate open)
 {
     DefaultInvoker.InvokeWithDefaultErrorHandling(() => open(ref _sid));
     Options = PrivateOptions = new OptionReaderWriter();
     Configure(_sid);
 }
Example #14
0
 public virtual void SetSize(string name, ulong sz)
 {
     DefaultInvoker.InvokeWithDefaultErrorHandling(() => _setUInt64(name, sz));
 }
Example #15
0
 public virtual void SetTotalMilliseconds(string name, int value)
 {
     DefaultInvoker.InvokeWithDefaultErrorHandling(() => _setDurationMilliseconds(name, value));
 }
Example #16
0
 public virtual void SetInt32(string name, int value)
 {
     DefaultInvoker.InvokeWithDefaultErrorHandling(() => _setInt32(name, value));
 }
Example #17
0
        public virtual void SetString(string name, string s)
        {
            var sz = (ulong)s.Length;

            DefaultInvoker.InvokeWithDefaultErrorHandling(() => _setString(name, s, sz));
        }
Example #18
0
 public virtual void Send(IEnumerable <byte> bytes, long count, SocketFlag flags = None)
 {
     DefaultInvoker.InvokeWithDefaultErrorHandling(() => __Send(_sid
                                                                , bytes.ToArray(), (ulong)count, (int)flags));
 }
Example #19
0
 public virtual void Send(string s, int length, SocketFlag flags = None)
 {
     DefaultInvoker.InvokeWithDefaultErrorHandling(() => __Send(_sid
                                                                , new StringBuilder(s), (ulong)length, (int)flags));
 }
Example #20
0
        public Listener(Socket s, string addr)
        {
            DefaultInvoker.InvokeWithDefaultErrorHandling(() => __Create(ref _lid, s.Id, addr));

            Configure(_lid);
        }