예제 #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);
        }
예제 #2
0
 internal static extern int SendTo(FileDescriptor sockfd, byte[] buf, int len, int flags, ref SockAddr dest_addr, int addrlen);
예제 #3
0
 internal static extern int RecvFrom(FileDescriptor sockfd, byte[] buf, int len, int flags, ref SockAddr dest_addr, ref int addrlen);
예제 #4
0
 internal static extern int Bind(FileDescriptor sockfd, ref SockAddr addr, int addrlen);