I rewrote a large part of the client/server application from the following thread:
https://forum.lazarus.freepascal.org/index.php/topic,48677.0.htmlHopefully I managed to address all the issues mentioned there:
- dropped RecvPacket(@kupferstecher)
- thread safety(@kupferstecher and others)
- the server's thread list now is properly locked with critical sections, each thread waits until the list is unlocked, no more connections are dropped(@piola)
- server works as a daemon/service too(@datilas), tested only on windows
- proper variables initialization(@Phoenix)
What's new:
- each file transfer has been moved to a worker thread, parallel file transfer is now possible
- newly connected/disconnected clients are highlighted for a custom amount of time
- added a new project(server_stress_test), server can be tested up to few thousand connections(requires 64 bit, see notes for more details)
- smaller stack size for each thread
- many more
Notes:
- there is a limited amount of threads that a 32 bit process(2 GB address space) can create. For better performance please build synapse client/server with a 64 bit version of Laz/FPC
- developed with Lazarus_Trunk/FPC_3.2.0(64 bit) on the following OSs: Windows 10(64 bit) and Linux Mint Cinnamon 20.02(64 bit), with synapse trunk(rev. 267)
- ico and res files are removed(forum attachment size limitation), please re-add the icons
- I did not have enough time to thoroughly test the projects