Because you write stuff to the socket you have opened, after "sockwrite -nt " ,which the command that writes to socket , you must use $sockname
The sockopen command doesnt need the $sockname identifier after it because it opens the socket you want. In your case "test"
So to open the sockname as you did at original script
sockopen Test thefaaborg.dk 80
And to write to the socket
sockwrite -nt $sockname <stuff here>
Also sockclose needs $sockname after it.
P.S just to be clear: $sockname returns the name of the socket. That eans that whatever the name of the socket is it will take the place of $sockname as am argument.
Example: just like $nick returns the name of the user that triggers the on text event