Example #1
0
        /// <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());
        }