This is a discussion on Re: I am looking for a good example of network applicationprogramming in C. - Linux ; On Thu, 2008-07-31 at 15:30 +0000, Jan Panteltje wrote: > On a sunny day (Thu, 31 Jul 2008 07:56:07 -0700 (PDT)) it happened > =?GB2312?B?0rvK18qr?= wrote in > : > > >Hi all, > > > >I am sorry if ...
On Thu, 2008-07-31 at 15:30 +0000, Jan Panteltje wrote:
> On a sunny day (Thu, 31 Jul 2008 07:56:07 -0700 (PDT)) it happened
> >Hi all,
> >I am sorry if my question sounds very naive.
> >My new job is writing a server application on Linux and my boss
> >strongly asked we write it with C to get better performance.
> >Although he doesn't programming much himself, my boss has **read**
> >many books on software engineering so I can not persuade him that an
> >OO style language might save us lot of trouble.
> >That's why I need a **good** example of network programming on C.
> Most of Linux stuff is open source, have a look at some applications
> that use a network.
> Like for example the good old IRC chat programs.
> >For some reason I have to use non-blocking IO. My problem is I don't
> >know the proper way to write a state machine that could change its
> >state when message received or a timer timeout.
> To ask the question in the right way, is also to have the answer.
> You are close, when timer times out change state variable :-)
> >Any books, projects, programming framework I could refer to ?
> You must absolutely read - and read again -, and use, libc.info.
> The gnu library also has many network examples, and describes each function
> in detail, likely aready on your system:
> ls -l /usr/share/info/libc.info*
> Unzip all files and cat together to one big textfile.
> Use a decent text editor (such a joe) to read it, and search for functions.
You can read it in HTML-form here too:
...and download it from here:
...or use your distro package manager:
root@blackbox:~# aptitude install glibc-doc
lnostdal@blackbox:~$ dpkg -L glibc-doc | grep index.html
lnostdal@blackbox:~$ firefox /usr/share/doc/glibc-doc/html/index.html &
Lars Rune Nøstdal