Quote Originally Posted by code_glitch View Post
That does look like it could make some headway actually, I'd never thought of looking there to be honest. The niceness of pascal: if you hadn't told me it was written in kylix I'd never have known
Well, the very first line uses unit "libc", which is a dead giveaway for Kylix. Unit libc is declared legacy, and will never be fully supported by FPC (libc unit deprecation )

I'll have a quick read tonight but I doubt I'll get any of it written into the server without me falling asleep so that'll have to wait until tomorrow i guess.
Don't do it manually. Try to use the FPC libraries for this (fcl-extra, daemonapp ) as possible. This delivers more chance that it will work between OSes and architectures (unit libc is not available for Mac, FreeBSD and Linux other than i386)

As far as the original problem goes, try to determine with strace what call exactly goes wrong. Are you reading from a socket in a different thread while closing it in another? Do you fpshutdown sockets properly?