Obtain the freeware tool 'lsof' or 'List Open Files' from the Purdue University archives:
ftp://lsof.itap.purdue.edu/pub/tools/unix/lsofBuild and install the tool, and run the command with the options:
lsof -i :xxxx
where xxxx is the port your program is using, and it will show any programs holding the port open. If you were using a debugger to look at the program, it may have held the port open after you were done looking at the program and did not exit from the debugger program.
Best wishes for solving the problem,
Don