Asm code not working anymore on PB v4 :(
If you want a timeout function (its probably not very safe but what the heck
)
Its just a part of a port scanner..
Its a bit messed up

Code: Select all
Procedure scan(i)
a=OpenNetworkConnection(target.s,i)
Debug a
If a
Print( " open!")
CloseNetworkConnection(a)
Else
Print( " closed!")
EndIf
EndProcedure
timeout=2000
th=CreateThread(@scan(),i)
If th
WaitThread(th, timeout) ;If the thread is created, wait the specified time till it stops. If not; continiue!
EndIf
If IsThread(th) ;Is thread active?
KillThread(th) ;if so, kill it.
Print( " Timeout! (possibly closed)")
EndIf
Its a bit messed up

I cannot, Thread safe, Mutex, ... so much nice features in PB v4 that I already use.Fred wrote:Please calm down. You can't be angry when you hack that much in the PB commandset. When we change something in the PB internals, we can't be backward compatiable with such hack. Just keep the v3.94 for your project and you're done.

I just hope you will add a TimeOut when you have some free time

Phlos; generally its not. However i havent found any problems in this situation.
but its true; the thread has no chance to free memory, or deallocating stuff. But then again; Why wouldn't the old memory just be overwritten. for this purpose it works great; but if you need to do more than this it might not be a good idea.
Actually; perhaps this is the way timouts normally work in these situations
Anyway its the only solution i got at the moment..
but its true; the thread has no chance to free memory, or deallocating stuff. But then again; Why wouldn't the old memory just be overwritten. for this purpose it works great; but if you need to do more than this it might not be a good idea.
Actually; perhaps this is the way timouts normally work in these situations

Anyway its the only solution i got at the moment..