 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Sat May 17, 2008 11:18 am Post subject: [Delphi] ServerSocket/ClientSocket |
|
|
Hello,
Yesterday I finished coding the 4-in-a-row game in delphi and decided to make it online.
I already started with the Server/Client and have done the Login-Part and chat-part.
But I do have some questions
1. Let's say, there is a playerlist, and every player who is logged in is listed there. So if someone closes the client the socket will disconnect and the server will remove the player from the list. But what if the player Terminates the client (by killing process ..) ? Then he will always be on the playerlist because he is not disconnecting correctly.
2. When the client sends a packet to the server then the server has to identify the client to know if it's john or peter, you know. So yet the client does send the player id in every packet, but that's very unsafe because of packet-editors. How should I handle that?
The source of the server and client are attached (w/o game). (Some people of the another forum helped me a bit so far)
MySQL data:
| Code: | /*
MySQL Data Transfer
Source Host: localhost
Source Database: 4gewinnt
Target Host: localhost
Target Database: 4gewinnt
Date: 17.05.2008 15:42:20
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`ID` int(20) NOT NULL default '0',
`username` varchar(50) default NULL,
`password` varchar(50) default NULL,
`wins` int(20) default '0',
`loses` int(20) default '0',
`all_games` int(20) default '0',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- ----------------------------
-- Records
-- ----------------------------
INSERT INTO `user` VALUES ('1', 'reak', 'test', '0', '0', '0');
|
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Sat May 17, 2008 11:46 am Post subject: Re: [Delphi] ServerSocket/ClientSocket |
|
|
| rEakW0n wrote: | | 1. Let's say, there is a playerlist, and every player who is logged in is listed there. So if someone closes the client the socket will disconnect and the server will remove the player from the list. But what if the player Terminates the client (by killing process ..) ? Then he will always be on the playerlist because he is not disconnecting correctly.[/code] |
Ping Pong?
| rEakW0n wrote: | | 2. When the client sends a packet to the server then the server has to identify the client to know if it's john or peter, you know. So yet the client does send the player id in every packet, but that's very unsafe because of packet-editors. How should I handle that?[/code] |
Create a new thread for each user? then handle each user's packets in diffrent threads, so the ID isn't important.
|
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Sat May 17, 2008 12:07 pm Post subject: Re: [Delphi] ServerSocket/ClientSocket |
|
|
| Symbol wrote: | | rEakW0n wrote: | | 1. Let's say, there is a playerlist, and every player who is logged in is listed there. So if someone closes the client the socket will disconnect and the server will remove the player from the list. But what if the player Terminates the client (by killing process ..) ? Then he will always be on the playerlist because he is not disconnecting correctly.[/code] |
Ping Pong? |
Yep, thought about that too, but ..how? (example)
| Symbol wrote: | | rEakW0n wrote: | | 2. When the client sends a packet to the server then the server has to identify the client to know if it's john or peter, you know. So yet the client does send the player id in every packet, but that's very unsafe because of packet-editors. How should I handle that?[/code] |
Create a new thread for each user? then handle each user's packets in diffrent threads, so the ID isn't important. |
Yes, someone else already told me this, I think I should use the indy-components :/
|
|
| Back to top |
|
 |
HalfPrime Grandmaster Cheater
Reputation: 0
Joined: 12 Mar 2008 Posts: 532 Location: Right there...On your monitor
|
Posted: Sat May 17, 2008 12:24 pm Post subject: |
|
|
1: Set a time-out on receive and drop the player if you don't receive a packet.
_________________
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|