Good man....glad the hints helped......
My test program is made up of many subroutines and is by far not complete or debugged as there are more things I wanted to do (but ran out of time), but it is not what I would class as a 'novice program', as I do not use a single global variable, I only use local variables which I pass through between subroutines, so error checking is always difficult.
I very rarely post any full code, just snippets as it's easier to follow.......However, I've attached the complete file save so you can dive into it and see how you get on.
You can load this into KROSET (LOAD tcp_client_v2.txt) and then just execute it as a PC task......eg..PCEXECUTE 1:tcp_main and the program should run.
See how you get on with it and if you have any questions, comments then let me know......but trust me, it is not a complete solution.