Kit
Kit

Reputation: 4105

Can Socket.io listen on multiple ports?

Is it possible for socket.io to listen on multiple ports in one server?

Background - I need to satisfy two problems:

1.Some cooperate & other closed networks block all traffic which does not use port 80.

2.Some anti viruses block websocket traffic on port 80. Port 4000 is the safest port to use.

I therefore need to my node server to be able to use port 80 and 4000 simultaneously. Has anyone experienced similar problems? How did you solve it?

Thank you.

Upvotes: 3

Views: 2552

Answers (1)

Ashish
Ashish

Reputation: 48

Suppose your process is listening on port 4000, it's my understanding you can use iptables to internally forward requests for port 80.

# iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 4000

/edit got the ports the wrong way around.

Upvotes: 1

Related Questions