Burkhard Carstens wrote:
Am Dienstag, 15. August 2006 18:00 schrieb Alexandre Leclerc:
Hi all,
I need to code a telnet server with specific commands and for client
devices to connect to it. Now I can pick Synapse which has a simple
telnet interface or Indy10 ported to FPC which looks to have a deeper
implementation of telnet. Now I don't know how is the port going and
official support one day... Any suggestion or both are good?
If you are talking about a tcp server, that understands a specific set
of text commands, I can recommend Indy's TIdCmdTCPServer. You can
simply add command handlers defining your command (command text,
parameter delimiter, normal reply, exception reply, disconnect after
command execution) and assign an eventhandler to it.
e.g.:
constructor mylass.create;
begin
inherited create;
server:=TIdCmdTCPServer.create;
server.defaultport:=19009;
with server.commandhandlers.add do begin
command:='status';
OnCommand:[EMAIL PROTECTED];
NormalReply.SetReply(200,'Ok');
Disconnect:=true;
end;
end;
procedure myclass.cmdStatusCommand(ASender : TIdCommand);
begin
ASender.Response.add('status line 1');
ASender.Response.add('status line 2');
end;
This is pretty easy. I use that a lot. You can yust use telnet to
connect to such a server, or write your own clients executing these
commands ..
Never used synapse, though
Also, I need to build a service application (for the telnet server -
obivious). - Is there support in FPC for the service interface like
in Delphi? or one needs to use another hack-program to fake a normal
software as registered service?
- For linux, is there anything special to do for the same service to
run out of the box?
No idea about this yet, but if you find out, please write a tutorial on
the wiki ;-)
Is there any sample of NT service for Lazarus/fpc ? WinSvc unit ? Other
unit which added allow installing console application as service ?
Regards
Boguslaw
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives