Solutions to problem

This is a discussion on Solutions to problem within the Networking/Device Communication forums, part of the General Programming Boards category; I am in the midst of writing a client application that requires some rather strange behaviour. From what i have ...

  1. #1
    Registered User
    Join Date
    Aug 2004

    Solutions to problem

    I am in the midst of writing a client application that requires some rather strange behaviour. From what i have decided i will be needing two threads, one thread to constantly be blocked on a recv call, processing information when it is received and sending replies back, and another thread to ensure that the connection has not been broken (it will sleep for 5 minutes then use a send call to ensure the connection is still live). Hopefully that was not too confusing. I have looked into timeout options in the TCP layer but quickly realised i should not be touching those values since on windows anways it would change the timeout behaviour for all applications and 2 hours is simply too long. Pretty much i just want people to let me know if they believe it is feasible to implement this on windows using threads and blocking socket calls or suggest alternate solutions.

  2. #2
    Registered User
    Join Date
    Nov 2001
    It's conceivable.


  3. #3
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    you know you can save yourself the threads and just use select() to check if there is incoming data before you call a blocking function such as recv().

    you can read about select() here: Beejís Guide to Network Programming
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe - Developing free software for the community.

  4. #4
    Registered User
    Join Date
    Sep 2004
    stacktrace >> what you outlined is a very common practive among networking applications. What you are doing is sending "keep alive" packets to the server in order to keep the connection open, and to know if/when it's been closed. Instead of waiting 5 minutes in between keep alive packets though, I suggest a smaller time frame (maybe 30 seconds).

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 09:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM
  5. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21