Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tserversocket... Bug or am I doing something wrong?

Status
Not open for further replies.

ianisit

Programmer
Oct 22, 2010
2
AU
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
 
One last thing. Im using RAD Studio Delphi 2010, on windows Vista. But running the same app on XP produces the same issues.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top