The OP code is missing anything that would actually make it work… I can’t seem to find a replacement for the link exactly, since it goes to the old wiki which is long gone… but…
this looks like someone mirrored it from the old wiki, before it went away. Unfortunately, the formatting is completely destroyed, but maybe you can recover it
It looks like that at least has the code to listen to a TCP socket and accept connections on it. (those are some keywords you might need if you want to do more searching on it)