I am using KryoNet to implement multiplayer functionality in my game. Now I don't want the same person to play more than once on the same server. Or to describe it a bit different: I don't want the same person have more than one connection established to the server.

Now I know you can't always suppress this. When someone is on different hosts/machines, he can do that. But at least I want to suppress more than one connection per machine.

How can I do that using KryoNet? Does KryoNet have such a functionality or do I have to code it myself?

I haven't tested it, but you can see the general idea here. Also, now that I think of it, it should be in the received method so that you may send back a error message to why the player was disconnected from the server.

Such controls must not be done at the IP layer because a lot of machines can share the same public IP address on Internet (when theses machines are on a LAN)You should envisage an authentification protocol (based on a registered account) and refuse to have the same account with 2 connections in the same time (whatever their IPs are).

Such controls must not be done at the IP layer because a lot of machines can share the same public IP address on Internet (when theses machines are on a LAN)You should envisage an authentification protocol (based on a registered account) and refuse to have the same account with 2 connections in the same time (whatever their IPs are).

That is a given. Not allowing to log into the same account more than once.

But I also want to prevent the same person playing with more than one account on the same server (at least on the same machine).

Such controls must not be done at the IP layer because a lot of machines can share the same public IP address on Internet (when theses machines are on a LAN)You should envisage an authentification protocol (based on a registered account) and refuse to have the same account with 2 connections in the same time (whatever their IPs are).

That is a given. Not allowing to log into the same account more than once.

But I also want to prevent the same person playing with more than one account on the same server (at least on the same machine).

An option is to let 2 accounts with the same ip to connect in the same time and on the other side create a tools that track theses situations in order to control theses semi-manually.When you detect such situation, you can imagine request an "identity check" (manually or not)You can also create a white liste of IP that being known as public site...

So, you can go on the "IP" blocking system, but you can loose a non-negligeable target (school, work station, family, ....)

In all case, it's not a simple problem.The best way is to discourage to run into multiple accounts by providing a well fitted game's contents (like social /guild, palmares / high score, etc...) that "force" the player to concentrate it's effort inside a single account for "be" the best.

Also, how could I make a KryoNet client send his mac address during connect (not after the connection is established, during establishment)?

You can't. You're going to have to connect, send the MAC address, then close the connection if it is a duplicate :\

What you should do is log connection attempts so if someone is spamming with multiple invalid connection attempts, you can choose to temporarily block the address from connecting. (Well, only if this becomes a problem, otherwise, I think the MAC address fix should work well)

He already has that implemented he says, and this is still good to have. If you think about it, you can make it so you can run any game you're not suppose to run multiple instances of locally on the same machine. However, most people won't go through the hassle.

IP and Mac filtering wont work as already pointed out it will result in way too many false positives.

To combat this you will need to have the users install some kind of spyware like Punk Buster. Even spyware wont protect you if the user simply uses 2 different computers so it's probably better to just accept it.

sorry to dredge up a post so far behind, but this is not neccesarily true. LANs aside, a single computer can have more than 1 IP address. This because each NIC (network interface card) has an IP, so if you have more than 1 NIC, you have more than 1 IP.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org