1. IMPORTANT - 11/13/2015: In light of a possible breach we have scrubbed all passwords. You will need to request a password reset through the site. Click here for more information.

timeout in microseconds

Discussion in 'Linux Networking' started by david1, Aug 8, 2012.

  1. david1

    david1 New Member

    Aug 8, 2012
    Likes Received:

    I would like to make a program to handle several communication modules.
    I have just found a good HOWTO. But I have got one problem. I want to handle a serial port with timeout in microseconds.
    Here is a code fragment from this site:

    int res;
    struct timeval Timeout;

    /* set timeout value within input loop */
    Timeout.tv_usec = 0; /* milliseconds */
    Timeout.tv_sec = 1; /* seconds */
    res = select(maxfd, &readfs, NULL, NULL, &Timeout);
    if (res==0)
    /* number of file descriptors with input = 0, timeout occurred. */

    I would like to have an extra variable for microseconds. :)
    Can I solve somehow this demand?

    The rest of HOWTO can be understood very well by me.

    I saw that microsecond cannot reach in an easy way neither in generally.

    Tanks, David

Share This Page