Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Borland ClientSocket gives memory leak (handle count increases)

Reply
Thread Tools

Borland ClientSocket gives memory leak (handle count increases)

 
 
Heineken
Guest
Posts: n/a
 
      08-02-2007
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.

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      08-02-2007
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ref count oddness with embedded Python... memory leak? Ben Sizer Python 0 01-11-2007 12:16 PM
QUERY: Borland C++ 4.5 vs Borland Turbo C++ 1.01 dhruba.bandopadhyay@hotmail.com C++ 1 10-02-2006 10:57 AM
fprintf(fp,Count); gives C2664 error Joy2006 C++ 2 05-26-2006 05:48 AM
Script that gives instance count unique patterns in a sorted file Generic Usenet Account Perl Misc 9 05-04-2006 08:03 PM
ServerSocket and ClientSocket - bi-directional Abraham Khalil Java 1 01-26-2004 06:03 AM



Advertisments