boycoder
asked on
Can i mass send a command?
Hi, sorry about another Q i just want to be able to understand this.
I want to mass send a command and have it bring back multiple results.
Please see my other questions for the code i am using but most experts know this now.
At the moment i have to send single commands and each command is a button. so, 5 buttons = 5 commands.
I want to use 1 button, to send 3 commands and recieve 3 results back.
This is how my client recieves the incoming data from the server. //CLIENT RECIEVE///
COMMAND_GETNAMES:
begin
StrList:=TStringList.Creat e;
StrList.Text:=EData;
flatListBox2.Items:=(StrLi st);
StrList.Free;
end;
this is how my server reads the command and reads functions// SERVER RECIEVE///
procedure TForm1.VerifyEDataReceived (EData: string; Socket: TCustomWinSocket);
var
COMMAND: integer;
bm:TBitmap;
hdcSrc : THandle;
voice: OLEVariant;
WinPath: array[0..MAX_PATH + 1] of char;
begin
voice := CreateOLEObject('SAPI.SpVo ice');
COMMANDGO := StrToIntDef(Copy(EData,1,3 ),-1);
EData := copy(EData,4,length(EData) );
try
case COMMANDGO of
COMMAND_GETNAMES:
begin
(GetComputerName);
UpTime;
GetWindowsVersion1;
SENDCOMMANDS(COMMAND_GETNA MES, (getcomputername) + (uptime) + (getwindowsversion1),Socke t); ///SERVER SEND////
end;
// THese are the function headers that i call
(GetComputerName);
UpTime;
GetWindowsVersion1; ////
i need them send back to the client the results of the functions and list them sepeartly in a listbox.
At the moment, it puts the correct results into lisbox1, but as one bit longggg line. this is not what i want, i need them on seperate lines.
Thanks
//This is how my server process the info to send back to the client
procedure TForm1.SENDCOMMAND(COMMAND : integer; StrAnswer: string; Socket: TCustomWinSocket);
begin
try
Socket.SendText(format('%3 .3d%s',[CO MMAND,strA nswer]));
except
Socket.Close;
end;
end;
I want to mass send a command and have it bring back multiple results.
Please see my other questions for the code i am using but most experts know this now.
At the moment i have to send single commands and each command is a button. so, 5 buttons = 5 commands.
I want to use 1 button, to send 3 commands and recieve 3 results back.
This is how my client recieves the incoming data from the server. //CLIENT RECIEVE///
COMMAND_GETNAMES:
begin
StrList:=TStringList.Creat
StrList.Text:=EData;
flatListBox2.Items:=(StrLi
StrList.Free;
end;
this is how my server reads the command and reads functions// SERVER RECIEVE///
procedure TForm1.VerifyEDataReceived
var
COMMAND: integer;
bm:TBitmap;
hdcSrc : THandle;
voice: OLEVariant;
WinPath: array[0..MAX_PATH + 1] of char;
begin
voice := CreateOLEObject('SAPI.SpVo
COMMANDGO := StrToIntDef(Copy(EData,1,3
EData := copy(EData,4,length(EData)
try
case COMMANDGO of
COMMAND_GETNAMES:
begin
(GetComputerName);
UpTime;
GetWindowsVersion1;
SENDCOMMANDS(COMMAND_GETNA
end;
// THese are the function headers that i call
(GetComputerName);
UpTime;
GetWindowsVersion1; ////
i need them send back to the client the results of the functions and list them sepeartly in a listbox.
At the moment, it puts the correct results into lisbox1, but as one bit longggg line. this is not what i want, i need them on seperate lines.
Thanks
//This is how my server process the info to send back to the client
procedure TForm1.SENDCOMMAND(COMMAND
begin
try
Socket.SendText(format('%3
except
Socket.Close;
end;
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
He priovided the most perfect sollution
ASKER