But how can I test it?
Or make threads?
To test it you could do an break inside the repeat until loop.
Below the memo1.Append('connection setted up!');
In that case, when the first connection is setup, the program will run on and your timer will function.
But it will only work once for the first connection you do.
When you end the connection and click the server button again, you'll get errors because there is already a listening socket (which you can't use anymore because you exited the function before).
If you really don't want to work with threads you need to setup the listening socket in formcreate (or in a special StartServer function) which you only execute once. Then the listening loop can be run (with another button or automatically). When the connection is terminated you can again run the loop function to listen for another connection.
But it would be better to move everything to a thread. In that case you can spawn multiple connections and receive messages from multiple clients.
In the standard .zip download of version 40 you'll find an example.
synapse40\source\demo\echo\echo.pas
(Although it's best you work with the trunk version at
https://sourceforge.net/p/synalist/code/HEAD/tree/trunk/ (use the download button right above) the examples are only to be found in the
synapse40.zip)