Quin wrote: Thu Apr 27, 2023 9:36 pm
Yeah, I'd want it to work like (Wait)WindowEvent(), so we have both a wait and non-wait version.
Couldn't you just code this? You really only want to delay when there is no event, otherwise, you want it to be as fast as possible, so I wouldn't.. I do the 2nd example.
Something like:
Code: Select all
Procedure WaitNetworkServerEvent(nTimeout, ServerID)
Protected nEvent, now=ElapsedMilliseconds()
Repeat
nEvent = NetworkServerEvent(ServerID)
If nEvent<>#PB_NetworkEvent_None
break
EndIf
delay(1)
Until ElapsedMilliseconds()-now >= nTimeout
ProcedureReturn nEvent
EndProcedure
Code: Select all
Repeat
nEvent = NetworkServerEvent()
Select nEvent
Case #PB_NetworkEvent_Data
Case #PB_NetworkEvent_Connect
Case #PB_NetworkEvent_Disconnect
Case #PB_NetworkEvent_None
Delay(1)
EndSelect
Until ExitSignal
that way 'data' is prioritized, with 'connect' the 2nd most important one...
Just my $.02