Thread: problem with select

  1. #1
    Registered User
    Join Date
    Jun 2003

    problem with select

    Hi there!

    I've got a problem with my select function. every time i call it, it's returning '1', indicating that from a socket can be read.

    here's a part of my code:
    struct timeval pTimeval;
    pTimeval.tv_sec = 0;
    pTimeval.tv_usec = 0;
    FD_SET(Socket, &fdRead);
    iRet = select(Socket + 1, &fdRead, NULL, NULL, &pTimeval); 
    if (FD_ISSET(Socket, &fdRead))
        iRet = recv(Socket, buffer, SIZE, 0);
    my Problem is, that i'm recv()'ing after the select() on the same socket (where isn't all the time data available) so my program blocks for the time, no data recieved.

    plz help me.

    thx Ice.

  2. #2
    Registered User
    Join Date
    Jun 2003
    what a miracle.... its working now. ^^

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Cool. I was going to suggest you post more code, as there isn't anything obviously wrong with that snippet.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. temperature sensors
    By danko in forum C Programming
    Replies: 22
    Last Post: 07-10-2007, 07:26 PM
  2. select() problem
    By nkhambal in forum Networking/Device Communication
    Replies: 3
    Last Post: 07-12-2005, 11:34 AM
  3. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM
  4. problem with output
    By Garfield in forum C Programming
    Replies: 2
    Last Post: 11-18-2001, 07:34 PM