Borland ClientSocket gives memory leak (handle count increases)

Discussion in 'C++' started by Heineken, Aug 2, 2007.

  1. Heineken

    Heineken Guest

    Hi,

    I have a problem with the clientsocket component in Borland C++
    Builder v6.0 - don't know if this is the correct forum. :-S

    The clientsocket component is used to connect to a serversocket
    component on another PC within my network - it all works fine, as long
    as the PC running the serversocket program is running. If I turn the
    PC off, the IP address is no longer available, and because I have the
    clientsocket connected to a timer, when the connection is lost, the
    client tries to connect to the server IP address over and over again.

    Whenever the clientsocket then throws an onerror event, I do the
    following:

    void __fastcall TSyslogForm::ClientSocket1Error(TObject *Sender,
    TCustomWinSocket *Socket, TErrorEvent ErrorEvent, int
    &ErrorCode)
    {
    ErrorCode = 0; //error is being handled

    Socket->Close();
    ClientSocket1->Close();

    Timer2->Interval = 5000; // 5 sec delay before reconnecting
    Timer2->Enabled = TRUE;
    }

    However - when the serversocket PC is turned off, the clientsocket
    reconnecting over and over again, results in a memory leak where
    Windows handles increases until I get an exception like "Windows
    socket error: An invalid argument was supplied (10022), on API
    'WSACancelASyncRequest'", or "Windows socket error [10055] on API
    connect".

    I haven't been able to find any solution for this problem. The handles
    are handled fine, if the serversocket PC is turned on, but without the
    serversocket running. Therefore the problem only seems to exists, when
    the IP address is unavailable.

    Hope to get some help, and thanx in advance! :)

    - Heine.
     
    Heineken, Aug 2, 2007
    #1
    1. Advertising

  2. Heineken wrote:
    > I have a problem with the clientsocket component in Borland C++
    > Builder v6.0 - don't know if this is the correct forum. :-S
    > [..]


    No, it this isn't the correct forum. Try 'borland.public.*'
    hierarchy.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Aug 2, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Abraham Khalil
    Replies:
    1
    Views:
    531
    Knute Johnson
    Jan 26, 2004
  2. Replies:
    1
    Views:
    1,159
    SuperKoko
    Oct 2, 2006
  3. Joey

    Memory increases for each webservice call

    Joey, Feb 3, 2005, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    108
    Dilip Krishnan
    Feb 3, 2005
  4. chen
    Replies:
    2
    Views:
    353
  5. Haircuts Are Important
    Replies:
    12
    Views:
    374
Loading...

Share This Page