[En-Nut-Discussion] Very Slow Socket Reading

Harald Kipp harald.kipp at egnite.de
Sun Jun 29 14:03:17 CEST 2003


Ralph,

the problem is the buffer so_rx_buf. I'm currently working
on a better solution. Basically so_rx_buf will be a NETBUF
fifo and a new byte counter will keep track of the number
of application data already read from the NETBUF on top.
This change will give an additional performance of about
100kByte/s and will dramatically increase the speed of fgetc
and fgets.

Don't look deeper into the current code, it's horrible. :-)
The whole so_rx_buf is moved on each fgetc. If you need speed
now, use NutTcpReceive.

Harald

At 16:27 29.06.2003 +1200, you wrote:

>I was using a Socket and noticed it was running progressively slower and
>slower.  So slow infact 4kb would basically never finish.
>
>The code I was using was basically
>
>while ( (i = fgetc(my_sock)) != EOF ){
>         //Do some stuff.....
>}
>
>has anyone else had this problem?
>
>Changing it to use a 256 byte buffer and using fread gave me a big boost in
>speed, but the socket is IO not compute constrained so it shouldn't have
>made any difference, it was like the fact I was reading it one char at a
>time was throttling it exponentially more and more.
>
>Any have any thought?
>
>Thanks
>Ralph
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.491 / Virus Database: 290 - Release Date: 18/06/2003
>
>_______________________________________________
>En-Nut-Discussion mailing list
>En-Nut-Discussion at egnite.de
>http://www.egnite.de/mailman/listinfo/en-nut-discussion




More information about the En-Nut-Discussion mailing list