Jump to content
  • Advertisement
Sign in to follow this  
luzarius

What is the best way for a server to identify a client?

This topic is 4464 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What is the best way for a server to identify a client? a) When client first logs into the server, the server creates a temporary ID and sends it back to the client. This temporary ID is now both on the server and client. Now when the client sends packets to the server this temporary ID will be in every packet so the server will know where this packet came from. OR b) When client first logs into the server, the server obtains the IP address of the client. Now when the client sends packets to the server, the server will know it is user X of IP address x.x.x.x because the server identifies the user by their IP address. OR C) implement both solutions OR D) other Please offer advice! :)

Share this post


Link to post
Share on other sites
Advertisement
I prefer to use the MAC Address from the client. If you have your program get the network hardware address you can use it as a unique ID for them. It will not change if they have to do a reboot for what ever reason.

Just my 2 cents.

theTroll

Share this post


Link to post
Share on other sites
... or maybe let the user login to an account on the server?
Store each user under a specific id in the server and then use that
id (which will always be unique :)

Share this post


Link to post
Share on other sites
If it's a TCP connection, just use the socket. If it's UDP, use the sockaddr struct which contains the ip/port.

Share this post


Link to post
Share on other sites
Good to identify computers by mac addresses, and identifying by just IP has a problem with those behind a nat. identifying by IP + port would probobly work pretty nicely.

Problem with using a unique ID though, is you have to make sure it's different than the actual object ID [the one you use to keep track of things in the game engine,the one you'll probably send out to all the other clients], or you may find yourself in a position of having players sending packets on the behalf of other players, or even one player playing as an entire group of characters. Might be a good idea to demand a mac address upfront durring login, match it with the ip/port, use the ip/port as the actual tracker data, and for each log in, check to make sure the mac address isn't already in the table [so you don't have the problem of a single computer logging in with a bunch of characters.. unless you don't mind that kinda thing]

Share this post


Link to post
Share on other sites
Does the client software obtain the mac address then send it to the server?

or

Does the server determine the clients mac address when the client tries to login (via tcp)

I am using TCP.

Share this post


Link to post
Share on other sites
The clinet determines its MAC and then durring the connection process sends the MAC to the server, it then tags all of it's traffic with the MAC address..

theTroll

Share this post


Link to post
Share on other sites
Quote:
Original post by RDragon1
If it's a TCP connection, just use the socket. If it's UDP, use the sockaddr struct which contains the ip/port.


'nuff said.

Share this post


Link to post
Share on other sites
I would use IP, port, and unique ID assigned by the server.
IP & port guarantee that you are sending to the real client.
unique ID guarantess that you are recieving from the real client.

A client can easily send a MAC address of another player. Thus if you only identify by MAC, any malicious player can easily tap into another players game.

Share this post


Link to post
Share on other sites
How can you get the MAC address of another player? I really don't think that unless you hand to be on the same network that it is possible. MAC address are layer 2 so unless you are on the physical network you should not be able to see another persons MAC address..

theTroll

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!