Re: [lwip-users] flow of lwip as a stream client

2012-03-05 Thread trex7
Again thanks for the helpful suggestions. I change the algorithm in a way that when the private buffer can accomodate more than TCP_WND I call the tcp_recved() with TCP_WND otherwise I call tcp_recved() with remaining buffer size. I need to review my code though because the tcp received callback

Re: [lwip-users] flow of lwip as a stream client

2012-03-02 Thread goldsi...@gmx.de
Bill Auerbach wrote: -Original Message- So, why don't you just use your received pbuf(s) directly in your audio function ? This way: - the size of your "buffer" (made of pbufs) is the size of your TCP window - the server cannot send more These 2 statements are true for calling tcp_recve

Re: [lwip-users] flow of lwip as a stream client

2012-03-02 Thread Bill Auerbach
>-Original Message- >So, why don't you just use your received pbuf(s) directly in your audio >function ? >This way: >- the size of your "buffer" (made of pbufs) is the size of your TCP >window >- the server cannot send more >- no copy, less memory used (only the TCP window vs buffer + TCP w

Re: [lwip-users] flow of lwip as a stream client

2012-03-02 Thread Stephane Lesage
> if(GetBufferFreeSize) // are there free space in the buffer? > { >pbuf_copy_partial (xxx, buf, GetBufferFreeSize, xxx ); >tcp_recved(xxx, GetBufferFreeSize); >copy_to_buffer(buf, GetBufferFreeSize); } > > It is by far not complete but I guess you understand what I mean. > Back to m

Re: [lwip-users] flow of lwip as a stream client

2012-03-02 Thread Simon Goldschmidt
"Bill Auerbach" wrote: > It seems from reading this discussion that perhaps tcp_recved is badly > named. It's not that it's been received but that it's been processed. I > would think tcp_processed (or similar) would convey a better meaning as to > what this function is accomplishing. I always

Re: [lwip-users] flow of lwip as a stream client

2012-03-02 Thread Bill Auerbach
It seems from reading this discussion that perhaps tcp_recved is badly named. It's not that it's been received but that it's been processed. I would think tcp_processed (or similar) would convey a better meaning as to what this function is accomplishing. >-Original Message- >Calling tcp_

Re: [lwip-users] flow of lwip as a stream client

2012-03-02 Thread Simon Goldschmidt
trex7 wrote: > I guess we have a communication problem here. Your proposal is exactly > what > I'm doing. Indeed we seem to have a communication problem. From what you have written in your last mail, my proposal is different than what you're doing: - You are always calling tcp_recved() when cop

Re: [lwip-users] flow of lwip as a stream client

2012-03-02 Thread trex7
Hi Simon, I guess we have a communication problem here. Your proposal is exactly what I'm doing. There was a mistake in displaying my code sample. The line tcp_recved() was a part my comment. This is done in the "do_the_copy_to_buffer_task()" pseudo code. The tcp_recved() is not called directly i

Re: [lwip-users] flow of lwip as a stream client

2012-03-02 Thread Simon Goldschmidt
trex7 wrote: > -I dont realy understand what you mean. I think, the scenario that I > cannot > process the incomming pbufs will always be there and I hope that lwip has > a > mechanism to handle this scenario without losing any data. > > Please correct me if I misunderstood anything. Thanks for

Re: [lwip-users] flow of lwip as a stream client

2012-03-02 Thread trex7
> 1. I just ignore them, no pbuf_free(). AND of course no tcp_recved(). >... and you return ERR_OK? In that case, the server won't resend the packets an you'll lose them. Yes, I return ERR_OK. >NO! You should only call tcp_recved() *AFTER* you have *PROCESSED* the data, not when you >enqueued

Re: [lwip-users] flow of lwip as a stream client

2012-03-02 Thread Simon Goldschmidt
trex7 wrote: > >>I think that you should buffer the pbufs, and NOT call tcp_recved() > >> until you consume a pbuf in your audio task. > > Nice Idea but thats one of the purpose of the buffer, to buffer the stream > so we can call tcp_recved as soon as possible so lwip can advertise a > larger >

Re: [lwip-users] flow of lwip as a stream client

2012-03-02 Thread trex7
>>I think that you should buffer the pbufs, and NOT call tcp_recved() >> until you consume a pbuf in your audio task. Nice Idea but thats one of the purpose of the buffer, to buffer the stream so we can call tcp_recved as soon as possible so lwip can advertise a larger window. Trex -- Stephan

Re: [lwip-users] flow of lwip as a stream client

2012-03-02 Thread Simon Goldschmidt
trex7 wrote: > I tried different cases when the buffer is full and I cannot process the > incomming pbufs > 1. I just ignore them, no pbuf_free(). AND of course no tcp_recved(). ... and you return ERR_OK? In that case, the server won't resend the packets an you'll lose them. > 2. I free the pbu

Re: [lwip-users] flow of lwip as a stream client

2012-03-02 Thread trex7
Thank you for answers. I tried different cases when the buffer is full and I cannot process the incomming pbufs 1. I just ignore them, no pbuf_free(). AND of course no tcp_recved(). 2. I free the pbuf with pbuf_free(). As always no calling of tcp_recved(). 3. I returned ERR_INPROGRESS and no pbuf_

Re: [lwip-users] flow of lwip as a stream client

2012-03-01 Thread goldsi...@gmx.de
mat henshall wrote: I think you will also want to return ERR_MEM from your callback, if I understand the code correctly, the stack will buffer the data for you and then will try again on the next fasttmr will try delivering the data again to your application. This way, when your circular buff

Re: [lwip-users] flow of lwip as a stream client

2012-03-01 Thread mat henshall
On Thu, Mar 1, 2012 at 8:53 AM, goldsi...@gmx.de wrote: > Robert wrote: > >> >I think that you should buffer the pbufs, and NOT call tcp_recved() >> until you consume a pbuf in your audio task. >> > > I think you will also want to return ERR_MEM from your callback, if I understand the code corre

Re: [lwip-users] flow of lwip as a stream client

2012-03-01 Thread goldsi...@gmx.de
Robert wrote: >I think that you should buffer the pbufs, and NOT call tcp_recved() until you consume a pbuf in your audio task. That's what I would do. However, your buffer has to be big enough to hold at least the complete initial receive window's size of data. Nice idea but the function t

Re: [lwip-users] flow of lwip as a stream client

2012-03-01 Thread Stephane Lesage
>>I think that you should buffer the pbufs, and NOT call tcp_recved() >> until you consume a pbuf in your audio task. > > Nice idea but the function tcp_recved() is callback in the raw API so > that is not possible as I understand it. tcp_recved() is not a callback, it's an API function you must

Re: [lwip-users] flow of lwip as a stream client

2012-03-01 Thread Robert
>I think that you should buffer the pbufs, and NOT call tcp_recved() until you consume a pbuf in your audio task. Nice idea but the function tcp_recved() is callback in the raw API so that is not possible as I understand it. What you can maybe do if you are writing the server software also is

Re: [lwip-users] flow of lwip as a stream client

2012-03-01 Thread Stephane Lesage
> Thanks for the reply. I'm indeed using a circular buffer to buffer the > incomming pbufs. My problem is that I don't how how to process the > pbufs if my circular buffer is full. That means that the decoder that > consumes the buffer is slower than the incomming pbufs. I dont want to > stop the

Re: [lwip-users] flow of lwip as a stream client

2012-03-01 Thread trex7
Thanks for the reply. I'm indeed using a circular buffer to buffer the incomming pbufs. My problem is that I don't how how to process the pbufs if my circular buffer is full. That means that the decoder that consumes the buffer is slower than the incomming pbufs. I dont want to stop the applicatio

Re: [lwip-users] flow of lwip as a stream client

2012-03-01 Thread Robert
Hi, This is what I think: You cant just stop the communication only because your puffer is full, and since you're waiting for the "music" information you cant just ignore it. So I would program a ring buffer in them the incoming information overwrites it self the whole time. http://en.wikip

[lwip-users] flow of lwip as a stream client

2012-03-01 Thread trex7
Hi, I'm using raw lwip 1.3.2 as a client for an audio stream based application. I'm a bit confuse how to handle the incomming pbufs when the audio buffer is full and I have to wait until the audio buffer has enough space to accomodate the pbuf. My code looks something like this: errt_t http_recv_