For the record, sizeof(struct sockaddr) will likely be too smal as the input
value.
You need to provide the real size of the socket address structure being
pointed to.

In this specific case, this would be sizeof(struct sockaddr_in).

On Thu, Sep 9, 2010 at 9:19 PM, fadden <fad...@android.com> wrote:

> On Sep 7, 10:02 pm, HISONA <hison...@gmail.com> wrote:
> > When, I call recvfrom function, but "struct sockaddr *addr" parameter
> > returns NULL value.
> [...]
> > int udp_read(int socket_no, char *str, int len, struct sockaddr
> > *addr)
> > {
> >         int read;
> >
> >         return recvfrom(socket_no, str, len, 0, addr, &read);
>
> The last argument is a value-result parameter ("fromlen") that should
> hold sizeof(struct sockaddr) on entry.  You're passing in an
> uninitialized value.  This will work or not depending on what value
> happens to be passed in.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to