Hi
Yes....
"
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XPMan, ScktComp, ExtCtrls;
type
TForm1 = class(TForm)
CSOCK1: TClientSocket;
XPManifest1: TXPManifest;
Button1: TButton;
MTXB1: TMemo;
TXTS1: TMemo;
Button2: TButton;
SVATT1: TTimer;
LBMSCOUNT2: TLabel;
procedure SVATT1Timer(Sender: TObject);
procedure CSOCK1Disconnect(Sender: TObject; Socket: TCustomWinSocket);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure CSOCK1Read(Sender: TObject; Socket: TCustomWinSocket);
procedure CSOCK1Connect(Sender: TObject; Socket: TCustomWinSocket);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
MSCOUNT2: integer;
VSOCKR2: string;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
CSOCK1.Active := true;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
CSOCK1.Socket.SendText(TXTS1.Text);
TXTS1.Lines.Clear;
end;
procedure TForm1.CSOCK1Connect(Sender: TObject; Socket: TCustomWinSocket);
begin
MTXB1.Lines.Add('Connected to server');
Socket.SendText('Client-Server connection successful');
end;
procedure TForm1.CSOCK1Disconnect(Sender: TObject; Socket: TCustomWinSocket);
begin
Windows.Beep(400, 100);
MTXB1.Lines.Add('Disconnected');
end;
procedure TForm1.CSOCK1Read(Sender: TObject; Socket: TCustomWinSocket);
begin
VSOCKR2 := Socket.ReceiveText;
if VSOCKR2 <> 'Response: Server recieved text.' then MTXB1.Lines.Add(VSOCKR2);
if VSOCKR2 = 'Response: Server recieved text.' then
begin
MSCOUNT2 := MSCOUNT2 + 1;
LBMSCOUNT2.Caption := IntToStr(MSCOUNT2);
end;
if VSOCKR2 = 'PING' then Socket.SendText(VSOCKR2);
end;
procedure TForm1.SVATT1Timer(Sender: TObject);
begin
if VSOCKR2 = 'Response: Server recieved text.' then
begin
if CSOCK1.Socket.Connected = true then CSOCK1.Socket.SendText('Testing server...');
end;
end;
end."
That's the modified code,, so now it still sends two on the same line.
It stops.
How can I fix that?
Sloppy, I know.
Disregard the unessecary parts like the PING part, which is a mistake.
The client sends a message, and then the server replies to each message with "Response: Server recieved text.". Then it goes on like that.
But the problem, is that sometimes when it's going really fast I see "Response: Server recieved text.Response: Server recieved text."
What do I do?
I understand what you're saying;
Bookmarks