Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Indy TCPServer problem with threads.

Status
Not open for further replies.

McGregor80

Programmer
May 15, 2005
13
PL
Hallo Everyone
I'm writing client server aplications using indy (BCB6) commponents. I was shure that it's everything working when i noticed that TCPServerOnExecute() doesn't work all the time. It seems that after execution thread is suspent or something else is going wrong with it. I've used MUTEX but i deleted every mutex from the source becouse it may be the reason. Unfortuantely nothing changed.

For example if i have 4 AThread->ThreadID's (1,2,3,4)
and 1' is executed it works but after a while when i know 1' is finished and i want him execute once more it doesn't go. Only when i execute 2' also the 1' will go but when i execute again 2' it doesn't and etc.

Please help me with this.
Thanks.

 
not that I could answer your problem, But I am
sure the experts here will agree It is hard to
diagnose a problem with no code example. In your
case I am sure there is a lot of code (probably
to much to post) and you are kinda stuck.

load your code with messages to indicate particular
events that can either be mesageboxes or just a
write to a log text file. I am not to good at the
fancy debugging techniques so this is what I rely upon.

I usually have a global called debug that I can set to
true and I use that to togal the debug messages.

If debug
display or write message

last resort take a week or two break and come back
to the code and you may find the answer staring you
in the face. It does work. ;-)

tomcruz.net
 
Thanks for suggestions. You are right, it wasn't enough that i wrote.

Fortunately i find a reason or this. Some threads during execution where stoped becouse there was small error becouse of cast to other type. There was no message with error but it was enough to hang.
On my form i placed ValueList and inserted many lines ex VL->Add(ThreadID,"position line");

this way i findout also why MUTEX wasn't going good.
Indy serwer allways executes thread and after doing it code it stops on next action that is related with socket. ex ReadLn. That's why when i closed all operations in MUTEX it stopped working. The thread jus stopped(for listening next action) inside MUTEX and didn't allowed other threads to enter MUTEX.

Maybe You knew it but i didn't

Anywhay. Thanks for help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top