secure connection between two servers ?

hello all,

i have a question if i have two servers each one run an application i want to make a tunnel channel between the two servers the two application each one has a specific port .

for example server A has port 2001 and server B has port 2002

server A talk to server A using any source port talking to the server B port 2002

server B talk to server B using any source port talking to the server A port 2001

i need connection secure between the two application to pass the traffic from each app

these application work in sun Solaris 10 if any one has a solution or any idea tell me

thanks alot

At first glance, I think you want sockets.

Here is how to make socket connections:
Beej's Guide to Network Programming