RECVFROM

BlopBlop Posts: 3
edited May 14, 2014 3:27AM in PInvoke.Net
Hello,

I didn't found the recvfrom function at pinvoke.net, so I thought it would be nice to add it since there already is the sendto function present (see http://pinvoke.net/default.aspx/ws2_32/SendTo.html).

This is what I think should be correct, however, I am not sure about the last parameter :
        [DllImport("ws2_32.dll")]
        public static extern int recvfrom(IntPtr Socket, IntPtr buf, int len, SendDataFlags flags, ref SockAddr from, IntPtr fromlen);

        public static int recvfrom(IntPtr Socket, IntPtr buf, int len, SendDataFlags flags, ref SockAddr from)
        {
            return recvfrom(Socket, buf, len, flags, ref from, IntPtr.Zero);
        }

I am basing the import on this signature : http://msdn.microsoft.com/en-us/library/windows/desktop/ms740120%28v=vs.85%29.aspx

And please, tell me when I am wrong. Bye !

Comments

Sign In or Register to comment.