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. General Programming
  3. C / C++ / MFC
  4. Bad bad service :-(

Bad bad service :-(

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
3 Posts 2 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.
  • N Offline
    N Offline
    Nish Nishant
    wrote on last edited by
    #1

    I am sunk in misery now. I have a program running as a service. It opens a TCP port [Winsock only/no CSocket stuff] and listens on it. Once a TCP connection is made it does some stuff which included inserting into an MS Access mdb. I use CDatabase for it. Now I have an unusual problem. After 2-3 days of running, the service suddenly starts hogging system resources. My machine crawls to a slow slow pace and I can't even move the mouse properly. If I stop and restart the service, with some difficulty given the system condition, it get's okay again. I am confused as to what's going on. What's funny is that for the last 2 days I haven't even connected to the TCP port. It was simply running blindly. The moment a client connects I use AfxBeginThread to start a thread that processes the TCP connection. Now what I feel is that the accept call fails and thus I am actually starting a thread and passing to it a bad SOCKET. I am not checking whether the SOCKET is okay. But what saddens me no end is the fact that this shouldn't be happening. Wht should accept fail? I thought accept would block and block and block and block and block and block and block till a connection is made :(( Regards Sad-Nish :(


    Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.

    D 1 Reply Last reply
    0
    • N Nish Nishant

      I am sunk in misery now. I have a program running as a service. It opens a TCP port [Winsock only/no CSocket stuff] and listens on it. Once a TCP connection is made it does some stuff which included inserting into an MS Access mdb. I use CDatabase for it. Now I have an unusual problem. After 2-3 days of running, the service suddenly starts hogging system resources. My machine crawls to a slow slow pace and I can't even move the mouse properly. If I stop and restart the service, with some difficulty given the system condition, it get's okay again. I am confused as to what's going on. What's funny is that for the last 2 days I haven't even connected to the TCP port. It was simply running blindly. The moment a client connects I use AfxBeginThread to start a thread that processes the TCP connection. Now what I feel is that the accept call fails and thus I am actually starting a thread and passing to it a bad SOCKET. I am not checking whether the SOCKET is okay. But what saddens me no end is the fact that this shouldn't be happening. Wht should accept fail? I thought accept would block and block and block and block and block and block and block till a connection is made :(( Regards Sad-Nish :(


      Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.

      D Offline
      D Offline
      Dor
      wrote on last edited by
      #2

      I had a simmilar problem, but it related to the Access database and i wasn't using a socket connection. It turned out that the ODBC driver you need to set up on the ODBC Cad 32 was out of date and the program just sat there chewing up processing time and ram... I don't know if this is your problem, but you could try to look at Access connection for the fault. Good Luck Dor

      N 1 Reply Last reply
      0
      • D Dor

        I had a simmilar problem, but it related to the Access database and i wasn't using a socket connection. It turned out that the ODBC driver you need to set up on the ODBC Cad 32 was out of date and the program just sat there chewing up processing time and ram... I don't know if this is your problem, but you could try to look at Access connection for the fault. Good Luck Dor

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #3

        Thanks Dor. What puzzles me is that when I am inserting, no probs at all. But I leave it idle for a couple of days and this happens :-( Nish p.s. I have added the check to see that the socket accept(...) returns is a valid socket. Hopefully, that should solve it :-)


        Regards, Nish Native CPian. Born and brought up on CP. With the CP blood in him.

        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