At 5:47 PM -0400 6/25/01, Gary Gorsline wrote:
>I have a new wireless app that use Minstrel S on Visor Prism (test device).
>Palm OS SDK Ref says that NetLibReceive uses fromAddrP and fromLenP and that
>they must point to a buffer that will hold the NetSocketAddrType and the len
>of that buffer. I don't use the result. On the POSE, it get a
>netErrParamErr when I make this call. On the device it appears to work
>fine. If I substitute NULL for both fromAddrP and fromLenP, it seems to
>work on both. I can not find documentation that says you really can use the
>NULLs.
>
>Why doesn't the following work on the POSE?? (Palm5debug ROM)
>
>Snippet:
>
>NetSocketAddrType SockAddr2;
>UInt16 SockAddr2Len = sizeof(SockAddr2);
>....
>RecvBytes = NetLibReceive(AppNetRefnum, Sock, RecvBuff, sizeof(RecvBuff), 0,
>&SockAddr2, &SockAddr2Len, AppNetTimeout, &ifErrs);
Gary,
It is indeed OK to pass NULL for the fromAddrP and fromLenP
parameters. I'm not sure why the documentation doesn't indicate this.
And perhaps what you're seeing in Poser is due to a kluge I put in
there when handling NetLib calls. In order to know if the
NetLibReceive call is dealing with a TCP or UDP socket and hence
needs to be translated into recv or recvfrom, Poser looks at the
fromAddrP parameter. If NULL, Poser assumes a TCP socket and calls
recv. Otherwise, it calls recvfrom. If you're passing in a buffer
when you don't need to, then Poser will think it's dealing with a UDP
socket and call recvfrom when instead it's actually dealing with a
TCP port. That could easily lead to the host computer returning an
error that gets translated into netErrParamErr.
I understand I should be calling getsockopt to make this
determination, but have never actually made the change. I guess I
should do that now...
--
-- Keith Rollin
-- Palm OS Emulator engineer
P.S. Check out the new e-mail address. [EMAIL PROTECTED] will work
for a while, but anyone mailing me needs to update to the new one
eventually.
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/