lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Recv en socket TCP


From: Kieran Mansley
Subject: Re: [lwip-users] Recv en socket TCP
Date: Wed, 30 Sep 2009 15:44:09 +0100

On Wed, 2009-09-30 at 12:48 +0200, Oscar F wrote:
> Hello again, the problem continous, in this moment i have achived
> accept the connection, then i have inserted in a select struct the
> three request socket .
> 
> When the customer send me a request i awake in select, but i can read
> anything, the program block in recv. The size of this reception is
> variable, in my first connection i ´must receive 10 bytes.

My guess is that you're stuck in this bit:

>   result = recv(s, BufferRx,sizeof(BufferRx), 0);    //Block the
> program and i saw with wireshark that the message is full with 10
> bytes

What is sizeof(BufferRx)?  The recv() function may block waiting for the
buffer to be full, so if you have given it a large buffer, you could
have to wait a while for it to fill up and return.  If I remember from
your earlier posts you don't have much memory allocated to network
buffers, so it may be that there are just not enough network buffers to
hold that amount of data, and it never gets full, and recv never
returns.

You could either:
 1) give a smaller length argument to recv() - it sounds like you only
want 10 bytes of data, so give it the value 10.
 2) make recv non-blocking by passing the MSG_DONTWAIT flag in the flags
argument - it will then return whatever data it can get (which may be
nothing, but as select has said there is some it should return
something).

Kieran





reply via email to

[Prev in Thread] Current Thread [Next in Thread]