示例#1
0
文件: UvTcp.cs 项目: codecopy/NLibuv
        /// <summary>
        /// Get the address of the peer connected to the handle.
        /// </summary>
        /// <returns></returns>
        public IPEndPoint GetSockEndPoint()
        {
            this.EnsureCallingThread();

            SockAddr socketAddress;

#if DOTNET_CORE
            int namelen = Marshal.SizeOf <SockAddr>();
#else
            int namelen = Marshal.SizeOf(typeof(SockAddr));
#endif
            Libuv.EnsureSuccess(Libuv.uv_tcp_getsockname(this, out socketAddress, ref namelen));

            return(socketAddress.ToIpEndPoint());
        }