NEED HELP Socket programming : HOW read and write with timeout

Discussion in 'Linux Networking' started by TF, Oct 13, 2005.

  1. TF

    TF Guest

    Hello,
    I have to do a program (C language) which :

    READ socket if nothing to be read then go to
    WRITE sochet if nothing to be wrote then go to READ
    in a while(1 loop.
    Thanks for help
     
    TF, Oct 13, 2005
    #1
    1. Advertisements

  2. TF

    Bit Twister Guest


    click up a terminal and do a
    man 2 read
    man 2 write

    If you look at the bottom of man pages you might see somethhing like
    SEE ALSO
    accept(2), bind(2), connect(2), fcntl(2), getpeername(2), getsock-

    which indicates you may find more information by doing something like
    man 2 connect.

    Want to find code examples.

    Please bookmark the following, very large,
    Frequently Asked Questions (faq) Search engine:

    http://groups.google.com/advanced_group_search
    key word(s) in the first box
    *linux* in Newsgroup box. You need to use the two
    asterisks around linux, pick English

    If you want/need more control over the first box search,
    http://www.google.com/help/refinesearch.html
     
    Bit Twister, Oct 13, 2005
    #2
    1. Advertisements

  3. TF

    Tauno Voipio Guest

    select() is the tool. man select, or Google.

    Next time, please cross-post, if you really need to
    post to multiple newsgroups. Now the responses from
    different groups are separate, and much of the info
    will be duplicated.
     
    Tauno Voipio, Oct 13, 2005
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.