Hi everyone,
Ive been working on development of a basic app that useds Tserversocket and Tclientsocket to send data over a network. Ive encountered an issue with data being echoed back to the client app from the Tserversocket app.
Code:
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
I : integer;
sRec : ansistring;
begin
for i := 0 to ServerSocket1.Socket.ActiveConnections-1 do
begin
with ServerSocket1.Socket.Connections do
begin
sRec := ReceiveText;
ReceiveText:='';
if sRec[1] = 'p' then
begin
Memo3.Lines.Add(RemoteAddress + ' sends :') ;
Memo3.Lines.Add(sRec);
SendText('P');
end;
end;
end;
end;
This is just a sample I have created that demonstrates the issue. When telneting to the server on port 23, the app will send a 'P' if it receives a 'p'. The problem is that the server is also sending back the lower case 'p' as well, as if the telnet client had localecho set... but this isnt the case.
Is there a buffer clear i need to do, or perhaps this is normal behavior for tserversocket, and I just need to turn off some feature that I dont know about?
Cheers,
Ian
Ive been working on development of a basic app that useds Tserversocket and Tclientsocket to send data over a network. Ive encountered an issue with data being echoed back to the client app from the Tserversocket app.
Code:
procedure TForm1.ServerSocket1ClientRead(Sender: TObject;
Socket: TCustomWinSocket);
var
I : integer;
sRec : ansistring;
begin
for i := 0 to ServerSocket1.Socket.ActiveConnections-1 do
begin
with ServerSocket1.Socket.Connections do
begin
sRec := ReceiveText;
ReceiveText:='';
if sRec[1] = 'p' then
begin
Memo3.Lines.Add(RemoteAddress + ' sends :') ;
Memo3.Lines.Add(sRec);
SendText('P');
end;
end;
end;
end;
This is just a sample I have created that demonstrates the issue. When telneting to the server on port 23, the app will send a 'P' if it receives a 'p'. The problem is that the server is also sending back the lower case 'p' as well, as if the telnet client had localecho set... but this isnt the case.
Is there a buffer clear i need to do, or perhaps this is normal behavior for tserversocket, and I just need to turn off some feature that I dont know about?
Cheers,
Ian