Re: [gnet] gnet is slooow in receiving data
- From: David Helder <dhelder umich edu>
- To: Tim Muller <tpm101 gmx net>
- Cc: Ron Arts <raarts netland nl>, <gnet gnetlibrary org>
- Subject: Re: [gnet] gnet is slooow in receiving data
- Date: Thu, 14 Nov 2002 11:34:50 -0500 (EST)
On Thu, 14 Nov 2002, Tim Muller wrote:
> I think the problem might be that you are using gnet_conn_readline().
>
> I would use gnet_conn_readany() with a buffer (not too small!).
>
> The drawback is that you have to assemble the pieces you get yourself and
> check for the end-of-line character yourself, but it should be a lot faster.
> I've done it this way in some apps of mine, and I haven't noticed any
> performance problems yet.
>
> Disclaimer: I'm not a gnet hacker, I might be totally wrong ;-)
Tim is right. gnet_conn_readline() reads one byte at a time. In order to
get faster IO, you'd need to read into a buffer and then check if there's
a line. gnet_conn_readline() does not buffer.
In GNet 1.1++, TcpSocket will derive from IOChannel, so you will be able
to use GLib 2's g_io_channel_read_line(). GLib 2 IOChannels can buffer.
David
--
__ _ __ David Helder - dhelder umich edu
___/ /__ __ __(_)__/ / <http://www.eecs.umich.edu/~dhelder>
/ _ / _ `/ |/ / / _ / DiaWebLog: <http://www.diaweblog.org>
|_,_/|_,_/|___/_/|_,_/ Paper CD Case: <http://www.papercdcase.com>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]