Hey nice job. Just a heads up. If using a port higher than 32767, the port sent to the router is invalid.
I see you are using the CUint function. I have removed that function, and this resolved...