Borland ClientSocket gives memory leak (handle count increases)

H

Heineken

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.
 
V

Victor Bazarov

Heineken said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top