socket connections behind routers


I created a tcp stream client/server winsock program in C++, they work fine if both machine are directly connected to the modem. However I am in a situation where the client, server or both can be behind routers,  and I am unable to establish client-server connections.

I don't want to change the router settings and I don't want  the communication to go through some intermediate server.

Are there any software solutions to establish socket connection directly when either party can be behind a router ?  (some sample source code would be appreciated :) )

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jaime OlivaresSoftware ArchitectCommented:
modern router have firewall features
if you want to communicate trough a specific socket port, you must ensure it is unlocked in router configuration.
Or you can try to use a standard port like 80 or 21 but not so recommendable.

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You might want to look into tunneling: [" Tunneling Explained"]

This is a very basic problem-- you can't have a server behind a firewall, as most firewalls block incoming connection attempts.   That's the whole point of a firewall.

You have to have some common meeting point that is NOT behind a firewall.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.