Esempio n. 1
0
        public byte[] Recv(int size, out IPEndPoint remote)
        {
            var buffer   = new byte[size];
            var sockAddr = new SockAddr();
            var addrSize = 16;
            var count    = IO.Check(IO.RecvFrom(SocketFileDescriptor, buffer, size, 0, ref sockAddr, ref addrSize));
            var slice    = buffer.Take(count).ToArray();

            remote = sockAddr.ToIPEndPoint();
            return(slice);
        }
Esempio n. 2
0
 internal static extern int SendTo(FileDescriptor sockfd, byte[] buf, int len, int flags, ref SockAddr dest_addr, int addrlen);
Esempio n. 3
0
 internal static extern int RecvFrom(FileDescriptor sockfd, byte[] buf, int len, int flags, ref SockAddr dest_addr, ref int addrlen);
Esempio n. 4
0
 internal static extern int Bind(FileDescriptor sockfd, ref SockAddr addr, int addrlen);