[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] UDP socket receive
From: |
Fabian Cenedese |
Subject: |
Re: [lwip-users] UDP socket receive |
Date: |
Wed, 30 Jan 2013 13:42:28 +0100 |
>You'll have to add a call to bind(). Something like:
>
>if (bind(sockfd, (struct sockaddr*)&addr, sizeof(struct sockaddr)) == -1)
>{
> perror ("bind");
> return (-1);
>}
>
>When you don't call bind(), the socket remains "unnamed" (in BSD-lingo).
>Hence, in lwIP lingo, the socket has "no recv function registered". Makes
>sense?
>
>BTW. It's smarter to clear 'addr' before settting up the rest of it:
> memset (&addr, 0, sizeof(addr));
I did that, I just left out the error handling etc to keep the mail short.
I also tried bind without success. However I have found my error.
Before using sockets I tried raw udp_* functions. This code was
still in so my port was already taken. Without it I can now use
the socket functions.
Thanks
bye Fabi