Page 2 of 2

Posted: Thu Feb 12, 2009 5:58 pm
by Trond
I still suspect the problem with your code is that you have a Delay(1) somewhere that triggers even if NetworkServerEvent() or WindowEvent() returns something else than 0. Removing that should fix the performance problem. (Or you may have a delay in the sending code, though that should be more obvious to spot.)

Alternatively, it may be easier and more reliable to put the networking code in a thread. That way there may be less clutter. In my opinion all network code should go in a thread because if it takes longer than normal (may happen on network failures) the user interface won't hang.

Posted: Thu Feb 12, 2009 7:16 pm
by Jordi
After all I have found a misstake, you are right Trond! a delay(1) is in between spaghetties. Simplifying:

Code: Select all

Repeat
        EventServer = NetworkServerEvent()
        If EventServer
           Select EventoServidor
   ...
           EndSelect
        EndIf
        Delay(1)
Until Quit = 1
If I delete Delay (1) I obtain a 100% used CPU but with below code (simplified) all seems ok:

Code: Select all

Repeat
        EventServer = NetworkServerEvent()
        If EventServer
           Select EventoServidor
   ...
           EndSelect
        Else
           Delay(1)
        EndIf
Until Quit = 1
Thanks to all for your help, please forgive me for this stupid post...

Next step increase the length of data send up to MTU length, compressing and crypting streams and put the networking routines inside in a thread. Job for a while.

Thks again Trond, Mahan and Thalius![/quote]