Sheel Scripting to lock 2 TCP unused ports in solaris and linux

My requirement is

I need to write a program in shell scripting to check 2 TCP unused unique port numbers in SOLARIS and I have to lock the same ports so that it will not be used in any other new process and the same port numbers should be used and locked in the LINUX machine to communicate between the LINUX and SOLARIS.

Any idea???

It would be of great help if you help me.

Thanks in advance.

Sreeram

i thought that once a service was running against a port --- that effectively locked it. for example, i don't believe you can suddenly decide to run something against port 23... or port 90.

Hi, thanks for ur reply.
I want to know the command for getting the unused ports both in solaris and linux

Thanks
Sreeram