Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. CSocket::CancelBlockingCall() from another thread?

CSocket::CancelBlockingCall() from another thread?

Scheduled Pinned Locked Moved The Lounge
sysadminquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Peter Sjostrom
    wrote on last edited by
    #1

    I use a CSocket derived class with a derived CWinThread class and use CArchive with it. For some yet unknown reason Send() locks after a while of running (hours). The opened socket has communication initiated from both client and server at times, if that helps. (Server sends tiny data once per second, client sends kB data occasionally, like every 10 seconds or so, plus both sides sends an ACK byte for every command) Anyway, since I cannot find the reason of the locking, I want to get around the locked state. I want to make something from the outside and would like to have an OnIdle timer reset at intervals in the CWinThread. A parent thread will check this timer and if it isn't reset in reasonable time (seconds) the parent thread will call CancelBlockingCall() on the locked socket. Now, will this work? Isn't it illegal to call the CSocket object function from another thread?

    L 1 Reply Last reply
    0
    • P Peter Sjostrom

      I use a CSocket derived class with a derived CWinThread class and use CArchive with it. For some yet unknown reason Send() locks after a while of running (hours). The opened socket has communication initiated from both client and server at times, if that helps. (Server sends tiny data once per second, client sends kB data occasionally, like every 10 seconds or so, plus both sides sends an ACK byte for every command) Anyway, since I cannot find the reason of the locking, I want to get around the locked state. I want to make something from the outside and would like to have an OnIdle timer reset at intervals in the CWinThread. A parent thread will check this timer and if it isn't reset in reasonable time (seconds) the parent thread will call CancelBlockingCall() on the locked socket. Now, will this work? Isn't it illegal to call the CSocket object function from another thread?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Read the message at the top of this page. X| Michael Martin Pegasystems Pty Ltd Australia martm@pegasystems.com +61 413-004-018 "Don't belong. Never join. Think for yourself. Peace" - Victor Stone

      N P 2 Replies Last reply
      0
      • L Lost User

        Read the message at the top of this page. X| Michael Martin Pegasystems Pty Ltd Australia martm@pegasystems.com +61 413-004-018 "Don't belong. Never join. Think for yourself. Peace" - Victor Stone

        N Offline
        N Offline
        NormDroid
        wrote on last edited by
        #3

        and to spell it out for you: Programming questions? Try the Forums: Visual C++ .NET C# COM SQL / ADO / ADO.NET Visual Basic Web Design General Discussions Code Requests Java Operating Systems Collaboration / Testing SysAdmin Suggestions Rant and Rave (Unmoderated) Ok :eek: Norm Almond Chief Technical Architect FS Walker Hughes Limited

        1 Reply Last reply
        0
        • L Lost User

          Read the message at the top of this page. X| Michael Martin Pegasystems Pty Ltd Australia martm@pegasystems.com +61 413-004-018 "Don't belong. Never join. Think for yourself. Peace" - Victor Stone

          P Offline
          P Offline
          Peter Sjostrom
          wrote on last edited by
          #4

          Crap, I saw the drop box display "Visual C++" and thought I was in the right area... thanks.

          L 1 Reply Last reply
          0
          • P Peter Sjostrom

            Crap, I saw the drop box display "Visual C++" and thought I was in the right area... thanks.

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            No worries. Michael Martin Pegasystems Pty Ltd Australia martm@pegasystems.com +61 413-004-018 "Don't belong. Never join. Think for yourself. Peace" - Victor Stone

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups