(spawn-tcp-server integer function) -> listener
Opens a socket at port integer. Function is evaluated when an outside connection is made.
Example:
(From Terminal "Alpha")
>> (spawn-tcp-server 9191 repl) :: [listener 5B0410]
(From Terminal "Beta")
$ telnet localhost 9191 Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. >>
While useful as a demonstration, for practical purposes, this example is dangerously insecure, and should be avoided.