You should be ok with port numbers greater than 1024. Usually with such applications, you could make the port number user configurable. So incase the connection fails because someone is using the port (one way to check whether a port is in use), the user can change the value.
Another way to detect used ports on a system would be to parse the output of the "netstat" command. Try typing "netstat /? "on the console for more information about this command.
Check out this
link for information about port numbers.
Hope this helps
Bilal Durrani
NI