Thread: what is the best way to implement simple checking mechanism

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    58

    what is the best way to implement simple checking mechanism

    Hello all im wandering what will be the best way to implement
    http checking mechanism , what i mean is that i need to query every N seconds if i have
    connection to my server .
    my idea was to start seperet thread from my main application ,this thread will start endless loop
    that will send http post massage to the server every N seconds . and the server will return response
    what do you think do you know better way to do this ?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Seems like one way that would work.

    What is your ACTUAL goal? If you describe further what you want to achieve, we may be able to come up with a better solution.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    85
    Depends on how you intend to implement it. If your using winsockets you could just wait till your send or recv loop didn't return SOCKET_ERROR.

  4. #4
    Registered User
    Join Date
    Mar 2008
    Posts
    58
    thanks for the fast reply my ACTUAL goal is simple i like to check if i have
    Internet connection all the time.
    i do use winsock and recv.
    they are in some class that handle the http port action .
    i dont see any way but adding another loop that will execute the http handler method
    every N seconds

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Overflow and range checking for mul/div
    By Elysia in forum C++ Programming
    Replies: 28
    Last Post: 06-06-2008, 02:09 PM
  2. Interpreter.c
    By moussa in forum C Programming
    Replies: 4
    Last Post: 05-28-2008, 05:59 PM
  3. Forced moves trouble!!
    By Zishaan in forum Game Programming
    Replies: 0
    Last Post: 03-27-2007, 06:57 PM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM