/// <summary> /// Receives a single handle from the socket /// </summary> /// <returns>The recieved handle or null.</returns> public IntPtr ReceiveHandle() { var res = UnixPInvoke.ancil_recv_fds_with_buffer(Socket.Handle, m_recvbuffer, 1u, m_buffer); if (res < 0 || res > m_recvbuffer.Length) { throw new System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error()); } return(res == 0 ? IntPtr.Zero : m_recvbuffer[0]); }
/// <summary> /// Receives a number of handles from the socket /// </summary> /// <returns>The recieved handles.</returns> public List <IntPtr> ReceiveHandles() { var res = UnixPInvoke.ancil_recv_fds_with_buffer(Socket.Handle, m_recvbuffer, (uint)m_recvbuffer.Length, m_buffer); if (res < 0 || res > m_recvbuffer.Length) { throw new System.ComponentModel.Win32Exception(System.Runtime.InteropServices.Marshal.GetLastWin32Error()); } return(new List <IntPtr>(m_recvbuffer.Take(res))); }