Soooo ... a bit of explanation:
Factorio (and the whole world with it) uses a ip address, port tuple to identify services programs running on servers. That result of this is that you can run multiple instances of Factorio (or Apache, or anything) on one computer without any problems, you just need them to use different port numbers.
Factorio by default uses port 34197, but as FishSandwich wrote, it can be changed in config. That is 34197 UDP -- a completely different thing than 34197 TCP.
Example:
1) server running on internal network with IP 10.0.0.1, Factorio at default 34197
2) internal network client with IP 10.0.0.2, Factorio at default 34197
3) second internal client on the same machine (to complicate stuff a little) with IP 10.0.0.2, port 3419
8
at this point both 2) and 3) should be able to just write "10.0.0.1" into the MP connect dialog and play on the server
or even connect 3) first, using "10.0.0.1", then connect 2) using "10.0.0.2:34198"
But now let's consider that you want to play over the internet.
4) is your router. It has public IP address 12.34.56.78 and forwards its port 34197 to 10.0.0.1:34197
5) is your remote friend
If the server is running and no one is connected, then 5) can connect to "12.34.56.78:34197" and start playing.
But if 2) or 3) was connected before, 5) will get kicked with the message you described.
The reason why this will happen is that everyone in game holds addresses it uses to communicate with other peers in game and everyone must be able to reach them.
The addresses are copied to the peer when he connects.
In our problematic scenario the server holds a list like this:
Code: Select all
10.0.0.1:34197 myself
10.0.0.2:34197 2)
10.0.0.2:34198 3)
But from 5)'s point of view the addresses don't make sense. He cannot reach any of the peers using addresses from this list.
This is to some extent a limitation of the P2P model we are using and to some extent a problem Factorio's implementation.
A workaround is for 2) and 3) to connect to the server using its public address "12.34.56.78:34197" as well. This way the router will change the addresses to its own external address and a random port (and it will keep the mapping while it is in use), and the list sent to 5) will be correct.
To play this way, only1) needs to have port forwarding set up. This trick is called NAT punchthrough and relies on the router allowing an incoming packets for some time after a outgoing packet was sent...
This all assumes that the router behaves the way we expect it. Which it may not. In that case I need to know what works, what doesn't, what configuration are you using and what workarounds help. There is a huge room for improvement in Factorio networking code :-)