Jop, hab zur Zeit den Port 2678 für meine Applikation freigegeben. Takes no Effect.
Edit: auch das deaktivieren der Firewall ist nicht die Lösung.
Edit2: Hier mal der vollständige Test Code:
Delphi-Quellcode:
program service_console;
{$APPTYPE CONSOLE}
uses
SysUtils,
IdBaseComponent,
IdComponent,
IdCustomTCPServer,
IdTCPServer,
IdContext;
const
iPort = 2768;
var
oTCPServer: TIdTCPServer;
procedure destroyServer;
begin
oTCPServer.Free;
Writeln('
[' + TimeToStr(Now()) + '
- ' + DateToStr(Now()) + '
] info -> Service stopped');
end;
begin
try
Writeln('
[' + TimeToStr(Now()) + '
- ' + DateToStr(Now()) + '
] info -> Service initialized');
oTCPServer := TIdTCPServer.Create(
nil);
try
oTCPServer.DefaultPort := iPort;
try
oTCPServer.Active := True;
except
Writeln('
[' + TimeToStr(Now()) + '
- ' + DateToStr(Now()) + '
] info -> port ' + IntToStr(iPort) + '
is in use.');
end;
if oTCPServer.Active
then
Writeln('
[' + TimeToStr(Now()) + '
- ' + DateToStr(Now()) + '
] info -> Service started on port ' + IntToStr(iPort));
finally
destroyServer;
end;
except
on E:
Exception do
Writeln(E.Classname, '
: ', E.
Message);
end;
end.
Ausgabe:
[20:15:56 - 11.07.2008] info -> Service initialized
[20:15:56 - 11.07.2008] info -> port 2768 is in use.
[20:15:56 - 11.07.2008] info -> Service stopped