I posted a message the other day about how I have a problem using
tPageControl and adding tTabSheets at runtime.
I'm really just looking for some idea's because I'm stumped.
My program uses a modified version of the ThrdSrv demo
My program is hanging in:-
procedure TCustomWSocket.DeleteBufferedData;
var
nItem : Integer;
begin
{$IFDEF COMPILER2_UP} { v5.25 }
EnterCriticalSection(GSendBufCritSect); This line hangs the
program after leaving TTcpSrvForm.WSocketServer1ClientDisconnect
If I don't add the following code to add and remove the tTabSheets it works
fine. Done in main thread.
procedure TTcpSrvForm.WSocketServer1ClientConnect(Sender:TObject;
Client:TWSocketClient; Error:Word);
begin
Try
tThrdSrvClient(Client).TabSheet:=tClientConnectTabSheet.Create(Self);
tThrdSrvClient(Client).TabSheet.AdvPageControl:=PageControl1;
*****This sometimes hangs the program when the second client connects.
After leaving WSocketServer1ClientConnect in client.Free******
Finally
End;
with Client as TThrdSrvClient do
begin
Display('Client connected.' +
' Remote: ' + PeerAddr + '/' + PeerPort +
' Local: ' + GetXAddr + '/' + GetXPort +
' ThreadID : $' + IntToHex(ClientThread.ThreadID, 8));
LineMode := False;
LineEdit := False;
LineLimit := 80; { Do not accept long lines }
OnDataAvailable := ClientDataAvailable;
OnLineLimitExceeded := ClientLineLimitExceeded;
OnBgException := ClientBgException;
ConnectTime := Now;
end;
end;
procedure TTcpSrvForm.WSocketServer1ClientDisconnect(Sender:TObject;
Client:TWSocketClient; Error:Word);
begin
tAdvTabSheet(tThrdSrvClient(Client).TabSheet).AdvPageControl:=Nil;
With tThrdSrvClient(Client) Do
Display('Client disconnecting: '+PeerAddr+' '+'Duration: '+
FormatDateTime('hh:nn:ss',Now-ConnectTime)+' ThreadID : $' +
IntToHex(GetCurrentThreadID, 8));
{ Clear WSocket reference in worker thread }
{ ClientThread.WSocket := nil; }
{ Break message pump within worker thread }
PostThreadMessage(tThrdSrvClient(Client).ClientThread.ThreadID, WM_QUIT,
0, 0);
{ Allow up to 10 second for thread termination }
WaitForSingleObject(tThrdSrvClient(Client).ClientThread.Handle, 10000);
end;
This always hangs the program in:-
procedure TCustomWSocket.DeleteBufferedData;
var
nItem : Integer;
begin
{$IFDEF COMPILER2_UP} { v5.25 }
EnterCriticalSection(GSendBufCritSect); This line hangs the
program after leaving TTcpSrvForm.WSocketServer1ClientDisconnect
Any help would be welcomed before I jump out of the window which is a shame
as it's a lovely day.
Thanks in advance
Gary
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be