Example #1
0
        static UdtSockHandle E(UdtSockHandle h)
        {
            if ((int)h == -1)
            {
                throw new UdtException();
            }

            return(h);
        }
Example #2
0
        public UdtSocket Accept(out IPEndPoint remoteEndpoint)
        {
            SockAddr addr;
            int      addrLen;

            UdtSockHandle h = E(UDT.Accept(this.handle, out addr, out addrLen));

            Debug.Assert(addrLen == addr.Size);

            remoteEndpoint = addr.ToIPEndPoint();
            CheckAddrVer(remoteEndpoint.AddressFamily);

            return(new UdtSocket(h));
        }
Example #3
0
        public UdtSocket(ProtocolType protocol, SocketType socketType)
        {
            if (protocol == ProtocolType.IPv4)
            {
                this.af = AddressFamily.InterNetwork;
            }
            else if (protocol == ProtocolType.IPv6)
            {
                this.af = AddressFamily.InterNetworkV6;
            }
            else
            {
                throw new ArgumentException("protocol", new NotSupportedException("Only support IPv4 and IPv6"));
            }

            this.handle = E(UDT.CreateSocket(this.af, socketType, protocol));
        }
Example #4
0
 internal static extern long SendFile(UdtSockHandle u, string path, ref long offset, long size, int block = 364000);
Example #5
0
 internal static extern int RecvBytes(UdtSockHandle u, byte[] buf, int len);
Example #6
0
 internal static extern int SendBytes(UdtSockHandle u, byte[] buf, int len, int ttl = -1, bool inorder = false);
Example #7
0
 internal static extern int Recv(UdtSockHandle u, byte[] buf, int len, int flags);
Example #8
0
 internal static extern int SetSockOpt(UdtSockHandle u, int level, UdtOption optname, ref byte[] optval, int optlen);
Example #9
0
 private UdtSocket(UdtSockHandle handle)
 {
     this.handle = handle;
 }
Example #10
0
 internal static extern int PerfMon(UdtSockHandle u, out UdtPerfInfo perf, bool clear = true);
Example #11
0
 internal static extern int Close(UdtSockHandle u);
Example #12
0
 internal static extern int Connect(UdtSockHandle u, ref SockAddr name, int namelen);
Example #13
0
 internal static extern UdtSockHandle Accept(UdtSockHandle u, out SockAddr name, out int namelen);
Example #14
0
 internal static extern int Listen(UdtSockHandle u, int backlog);
Example #15
0
 internal static extern int Bind(UdtSockHandle u, ref SockAddr name, int namelen);
Example #16
0
 internal static extern long RecvFile(UdtSockHandle u, string path, ref long offset, long size, int block = 7280000);
Example #17
0
 internal static extern int EpollRemoveUdtSock(int eid, UdtSockHandle u);
Example #18
0
 internal static extern int GetSockName(UdtSockHandle u, out SockAddr name, out int namelen);
Example #19
0
 internal static extern UdtState GetSockState(UdtSockHandle u);
Example #20
0
 internal static extern int GetSockOpt(UdtSockHandle u, int level, UdtOption optname, out byte[] optval, out int optlen);