1

I'm interested in differentiating connections coming from the same PC. socket.request.connection.remoteAddress; works perfectly for me on 1.0.4 to give me the public IP, but it will run into trouble when people are behind routers

For public ip - Get the client's IP address in socket.io

Community
  • 1
  • 1
sharky
  • 327
  • 4
  • 13

1 Answers1

0

You have to use a combination of remote IP and remote Port to differentiate connections. If multiple connections come from behind the same router, your server would see them having the same public IP from the router, but they would be using different ports.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
  • i'm interested in differentiating PC's, if multiple connections arise from the same PC, they will still have different ports, hence would not help my case. – sharky Jul 08 '14 at 16:51
  • 2
    In order to differentiate PCs that are behind the same router, each client would have to explicitly send its local LAN IP to your server after connecting to it, such as in a hello message. Multiple clients on the same PC would have the same LAN IP. TCP alone would not be able to get that info. Otherwise, you would have to implement user accounts on your server and have each client login to a different account. – Remy Lebeau Jul 08 '14 at 17:50