I am looking for a good example of network application programming inC. - Linux

This is a discussion on I am looking for a good example of network application programming inC. - Linux ; 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 ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: I am looking for a good example of network application programming inC.

  1. I am looking for a good example of network application programming inC.

    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.

    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.

    Any books, projects, programming framework I could refer to ?

    Thanks a lot!

  2. Re: I am looking for a good example of network application programming inC.

    On a sunny day (Thu, 31 Jul 2008 07:56:07 -0700 (PDT)) it happened
    =?GB2312?B?0rvK18qr?= wrote in
    <37bb23c3-fb43-4d01-a1af-9aa5f7f7eb47@1g2000pre.googlegroups.com>:

    >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.

    >Thanks a lot!
    >


  3. Re: I am looking for a good example of network application programming in ?C.

    ??? wrote:
    > 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.
    >
    > 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.
    >
    > Any books, projects, programming framework I could refer to ?
    >
    > Thanks a lot!


    Get your hands on a copy of W. Richard Stevens "UNIX Network
    Programming".

    Jerry

  4. Re: I am looking for a good example of network application programming in C.

    =?GB2312?B?0rvK18qr?= writes:

    >My new job is writing a server application on Linux and my boss
    >strongly asked we write it with C to get better performance.


    Hi,

    Unsure how much internetworking, Linux, or C programming knowledge you
    have already, but I feel you'll get much value from:

    http://www.beej.us/guide/bgnet/

    --
    Chris.

  5. Re: I am looking for a good example of network applicationprogramming in ?C.

    Thanks a lot.

    I skimmed the 1st volume of the book. it's a good book for
    beginners. But these examples are too simple for me, and as I
    described, I can not use the multi-threaded or multi-process model on
    this project. At least the 1st volume doesn't talk much about the non-
    blocking mode.

    Should I buy and read the 2nd volume?

    On Aug 1, 4:07*am, Jerry Peters wrote:
    > ??? wrote:
    > > 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.

    >
    > > 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.

    >
    > > Any books, projects, programming framework I could refer to ?

    >
    > > Thanks a lot!

    >
    > Get your hands on a copy of W. Richard Stevens "UNIX Network
    > Programming".
    >
    > * * * * Jerry



  6. Re: I am looking for a good example of network application programming in C.

    һʫ writes:

    > 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.

    Well I can fully agree with this things. It really depends which OO
    language you're talking about.
    >
    > That's why I need a **good** example of network programming on C.

    Have you considred using anything form the apache project, what is
    good for 2/3 of all Webservers should be fine for any need....
    I'd especially look for the lipabpr and then you can check the sources
    of apache and/or subversion also...

    Regards
    Friedrich




    --
    Please remove just-for-news- to reply via e-mail.

  7. Re: I am looking for a good example of network applicationprogramming in C.

    On 2008-07-31, 一首诗 wrote:
    > 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.


    "OO style?"

    > That's why I need a **good** example of network programming on C.


    > For some reason I have to use non-blocking IO.


    if you can't fork, It's that or using threads, non-blocking is probably
    easier to debug.

    > 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.


    you'll probalby need to use select or pselect.... there's some good
    examples in the manual

    > Any books, projects, programming framework I could refer to ?


    LPG, for a start...

    the apache / inetd / bind / sn (etc...) source.
    pick the simplest server that's similar to your needs and look at the
    source.

    Bye.
    Jasen

  8. Re: I am looking for a good example of network application ?programming in ?C.

    ??? wrote:
    > Thanks a lot.
    >
    > I skimmed the 1st volume of the book. it's a good book for
    > beginners. But these examples are too simple for me, and as I
    > described, I can not use the multi-threaded or multi-process model on
    > this project. At least the 1st volume doesn't talk much about the non-
    > blocking mode.
    >
    > Should I buy and read the 2nd volume?
    >
    > On Aug 1, 4:07*am, Jerry Peters wrote:
    >> ??? wrote:
    >> > 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.

    >>
    >> > 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.

    >>
    >> > Any books, projects, programming framework I could refer to ?

    >>
    >> > Thanks a lot!

    >>
    >> Get your hands on a copy of W. Richard Stevens "UNIX Network
    >> Programming".
    >>
    >> * * * * Jerry

    >

    Same author, Advanced Programming in the UNIX Environment. Read the
    sections on select and poll.

    Jerry

  9. Re: I am looking for a good example of network application programming in C.


    "???" wrote in message
    news:37bb23c3-fb43-4d01-a1af-9aa5f7f7eb47@1g2000pre.googlegroups.com...
    > 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.


    Your Boss is absolutely right, you need to use C/C++ for coding efficient
    network app./server. and in fact, many flexibility or features is only
    possible only if you use the same language as the library which created
    them.

    But C++ is an extension to C, so I dont understand why our say OO
    (Object-Oriented) style *language is better, because C++ *language is iteslf
    OO language.
    In fact, many other languge is somehow influenced or just copy-cat of C++.
    (include C# and VB.net, php, Java), and for eg, MFC is build by C++.

    I assume you are using BSD socket style of programming, then regardless of C
    or C++ (OOP), you are still calling the same library with same method, just
    your program will be more organized and reusable in large development
    environment.(only if you know OOP concept well).

    >> That's why I need a **good** example of network programming on C.
    >>
    >> 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.


    The thing is,
    1. you need to know multiprocess/multitasking/IPC technique under Linux
    platform.
    2. you need to know socket programming technique, non-blocking mode, like
    select() API.
    3. you need to know state-machine concept, any good Software Enginnering
    book should give you a clue.

    For (1) and (2), It is no so difficult, use see the default "man" sample
    code under you linux.
    For (3), it is not something lenghtly subject, spend hour or few will help.

    The important is, you need to practise it, only then your skill will be
    improved.


    >> Any books, projects, programming framework I could refer to ?
    >>
    >> Thanks a lot!


    Good luck...




+ Reply to Thread