[twsocket] tThrdSrv
Hi, I have an application which is basically a modified version of the tthrdsrv application which works except for the following. In the tTcpSrvForm.WsocketClientConnect (Main Thread) I add a tTabSheet to a tPageControl for each connection which works ok. In tTcpSrvForm.WSocketClientDisconnect I remove the TabSheet from the tPageControl when the connection finishes. After this randomly sometimes the tTcpSrvForm.WSocketClientConnect will hang the Application; other time tcpSrvForm.WSocketClientDIsconnect will hang the Application but not when adding or removing the TabSheets. The reason I think it's something to do with the tTabSheet is that if I don't remove the tTabSheet's in tcpSrvForm.WSocketClientDIsconnect it always works just adding TabSheets. Is this the correct place to add and remove the tab sheets as its in the main thread I think. Or should I do it a different way. Thanks 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
Re: [twsocket] tThrdSrv
I think the comment in the demo is not correct. Actually OnClientConnect is triggered in worker thread context. You can easily check the thread context by calling Windows.GetCurrentThreadID. So probably event OnClientCreate was the place to add the new tab. -- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Gary Stafford wrote: Hi, I have an application which is basically a modified version of the tthrdsrv application which works except for the following. In the tTcpSrvForm.WsocketClientConnect (Main Thread) I add a tTabSheet to a tPageControl for each connection which works ok. In tTcpSrvForm.WSocketClientDisconnect I remove the TabSheet from the tPageControl when the connection finishes. After this randomly sometimes the tTcpSrvForm.WSocketClientConnect will hang the Application; other time tcpSrvForm.WSocketClientDIsconnect will hang the Application but not when adding or removing the TabSheets. The reason I think it's something to do with the tTabSheet is that if I don't remove the tTabSheet's in tcpSrvForm.WSocketClientDIsconnect it always works just adding TabSheets. Is this the correct place to add and remove the tab sheets as its in the main thread I think. Or should I do it a different way. Thanks 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
Re: [twsocket] tThrdSrv
Arno Garrels wrote: I think the comment in the demo is not correct. Actually OnClientConnect is triggered in worker thread context. You can easily check the thread context by calling Windows.GetCurrentThreadID. So probably event OnClientCreate was the place to add the new tab. Please forget my previous message, I'm down today. Both events are triggered in main thread so the place to add and remove tabs should be OK. Sorry, I need vacation. -- Arno Garrels [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html Gary Stafford wrote: Hi, I have an application which is basically a modified version of the tthrdsrv application which works except for the following. In the tTcpSrvForm.WsocketClientConnect (Main Thread) I add a tTabSheet to a tPageControl for each connection which works ok. In tTcpSrvForm.WSocketClientDisconnect I remove the TabSheet from the tPageControl when the connection finishes. After this randomly sometimes the tTcpSrvForm.WSocketClientConnect will hang the Application; other time tcpSrvForm.WSocketClientDIsconnect will hang the Application but not when adding or removing the TabSheets. The reason I think it's something to do with the tTabSheet is that if I don't remove the tTabSheet's in tcpSrvForm.WSocketClientDIsconnect it always works just adding TabSheets. Is this the correct place to add and remove the tab sheets as its in the main thread I think. Or should I do it a different way. Thanks 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