Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Apr : Re: idTcpServer or idCmdTcpServer - D7 indy10.1.5
| Subject: | Re: idTcpServer or idCmdTcpServer - D7 indy10.1.5 |
| Posted by: | "Jacques Noah" (jacques.no..@btinternet.com) |
| Date: | Wed, 19 Apr 2006 01:49:34 |
> Or, the client could simply disconnect without telling the server at all,
> and the server can automatically "free" any dropped connections.
The idea is that the server will act as the 'control center' for the system.
For example, when a new user wants to use the internet, the operator of the
system should be able to 'unlock' a client computer by sending a command to
the client machine, whos name will be on a list that was created when a
client connected to the server. The only time that the client should
disconnect is when the internet cafe closes. basically, i want everything to
be controlled from the server application.
Maybe i'm not doing this right, but when i try to send a cmd from the
server(using idTcpServer) i cant find the SendCmd() property or anything
else that i can use to send a cmd. there is the OnExecute property that
responds to cmds recieved from clients which is fine, but how do i send a
cmd using a button for example, i need to sent a cmd like the following:
start:10@WorkStation1
I use a parse function to break this up into: cmd, minutes to allow internet
access and computername. This activates a timer on the client computer and
allows the user 10 minutes internet access. I've created the class below to
store client data:
TiContext = class(TIdContext)
public
IP: String;
Con: TDateTime;
compname:string;
procedure SendCd(const WStation: string; const mins:integer);
end;
The procedure checks if a client name exist on a list and then sends the
information to it. I just need to know how to send this info to the client
from a button event.
I hope this makes sense..
cheers
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:44456dad$1@newsgroups.borland.com...
>
> "Jacques Noah" <jacques.noah@btinternet.com> wrote in message
> news:444564c6@newsgroups.borland.com...
>
>> Well the clients have to sent their status to the server, for example
>> when a user has reached the end of their allowed internet access
>> time, the client would send a message back to the server telling it
>> that it is 'free'.
>
> Or, the client could simply disconnect without telling the server at all,
> and the server can automatically "free" any dropped connections.
>
>> That is the only communication between the server and the client
>> apart from the onConnect event.
>
> Based on your description above, if you do what I suggest, there you would
> have no more need for the client to send commands to the server.
> Code-wide,
> you can then use TIdTCPServer on the server-side, and TIdCmdTCPClient on
> the
> client-side. As for status updates, you could have the server
> periodically
> poll the active clients via a command that they respond to. That would
> also
> act as a kind of keep-alive so the both the client and server can detect
> lost connections.
>
>
> Gambit