Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Nobody <nobody@nowhere.com> |
|---|---|
| Subject | Re: Small tcp client for review |
| Date | 2011-09-10 08:25 +0100 |
| Message-Id | <pan.2011.09.10.07.25.27.642000@nowhere.com> |
| Newsgroups | comp.lang.c |
| References | <d9a9b4b9-9a5e-4107-b518-a13904e69021@g19g2000prf.googlegroups.com> |
| Organization | Zen Internet |
On Fri, 09 Sep 2011 10:46:12 -0700, Ram Prasad wrote: > I am a perl programmer , need to write a small tcp client in C to pass > the input to a perl Daemon > This is going to be a very high volume application , So I better make > sure the code is efficient enough. If you want efficiency, see if you can avoid TCP in favour of Unix-domain sockets. A connection to a Unix-domain socket is just a bidirectional pipe. A TCP connection, even one via the loopback interface, involves splitting the data into packets, calculate checksum, routing, firewall, validate checksum, reassembly. As for your code: I don't see any reason to copy the data line-by-line; replacing fgets() with read() may provide some performance gain. A bigger performance gain could be obtained by eliminating your program entirely, by having whatever would otherwise write to your program's stdin talk to the daemon directly.
Back to comp.lang.c | Previous | Next — Previous in thread | Find similar | Unroll thread
Small tcp client for review Ram Prasad <ramprasad.ap@gmail.com> - 2011-09-09 10:46 -0700
Re: Small tcp client for review Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-09-09 20:44 +0100
Re: Small tcp client for review Gene <gene.ressler@gmail.com> - 2011-09-09 13:43 -0700
Re: Small tcp client for review Ram Prasad <ramprasad.ap@gmail.com> - 2011-09-09 23:02 -0700
Re: Small tcp client for review Ralph Spitzner <rasp@spitzner.org> - 2011-09-10 08:40 +0200
Re: Small tcp client for review Seebs <usenet-nospam@seebs.net> - 2011-09-13 06:44 +0000
Re: Small tcp client for review Nobody <nobody@nowhere.com> - 2011-09-10 08:25 +0100
csiph-web