It won't if you don't do things in the correct order.
In your snippet above, you are using:
Set net connection 3,myipadress
perform checklist for net sessions
How can you Set Net Connection 3 before the program knows that connection 3 is actually there? You then perform a check for SESSIONS which is only possible AFTER you have connected to the remote machine.
Try this on it's own:
Perform Checklist For Net Connections
NumConnections = checklist quantity()
Print NumConnections
If it prints anything bigger than 0 then connections are available. If it prints 0 then you don't have any connections.
My guess is that it's closing the program because you are attempting to Set Net Connection before you have checked to see if any connections are available, (assuming that your code is the same as posted above).
In that turorial, although it is about writing the program that runs at the
other end, you have to do things in the same order to make the initial connection.
Once you have connected, only
then do you do a checklist for sessions.
TDK_Man