hab ich, aba es geht noch nicht, hier nochmals der aktuelle code:
Delphi-Quellcode:
program Project2;
{$APPTYPE CONSOLE}
uses
SysUtils,
ScktComp;
type
test=class
public
//socket: Tserversocket;
procedure socketClientRead(Sender: TObject;
Socket: TCustomWinSocket);
procedure socketClientError(Sender: TObject;
Socket: TCustomWinSocket);
procedure go;
procedure SocketClientConnect;
end;
var socket: Tserversocket;
e1,cmd: string;
test1: test;
procedure test.socketClientError(Sender: TObject;
Socket: TCustomWinSocket);
begin
writeLn('test');
end;
procedure test.socketClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var cmd: string;
begin
writeLn('GEHT DOCH');
cmd:=socket.ReceiveText;
writeLn(cmd);
//socket.free;
end;
procedure test.SocketClientConnect;
begin
writeLn('TEST');
end;
procedure test.go;
begin
socket:=tserversocket.Create(nil);
writeLn('PleaseEnterPort');
readln(e1);
// try
//socket.Active:=false;
socket.Port:=strtoint(e1);
socket.ServerType:=stNonBlocking;
socket.OnClientRead := socketClientRead;
socket.OnClientConnect := SocketClientError;
socket.OnClientDisconnect := SocketClientError;
//
socket.Open;
socket.Active:=true;
// except
// socket.Free;
// end;
// readln;
end;
begin
{ TODO -oUser -cConsole Main : Hier Code einfügen }
//readln;
//test1.Create;
test1:=test.Create;
test1.go;
readln;
test1.free;
end.