Home > Back-end >  Questions about the clientsocket controls using the card
Questions about the clientsocket controls using the card

Time:10-03

With ClientSocket1 receive information, because someone sent to come over to have a larger amount of information, the average 3-10 per second, the results the entire program is stuck in there, don't move, thought is the problem that took the information after processing, remove after receiving the storage and display of information, or card, don't move the program, this is all the code:
Procedure THIPSAPPFrm. ClientSocket1Read (Sender: TObject;
Sockets: TCustomWinSocket);
Var
Fitem Sitem: Tlistitem;
The begin
AttanceInt:=0;
Data analysis part slightly,,,,,,,
//here converts GB2312 Chinese decoding formats to decode unicode general Chinese format
Messtr:=UTF8Encode (Messtr);
Messtr:=UTF8Decode (Messtr);
//OAPPIMessage OIApp task will be submitted to the APP server data center
AttanceInt:=GetAttanceUser (mobileID, Messtr);
If (strtoint (copy (mobileID, 1, 1)) in [0.. 9]) and (length (Messtr) & gt; 1) and (AttanceInt=1) then//the judgment according to
the condition ofThe begin
If setfrm. OnRecSMSChB. Checked=true then
Messtr:=messtr + setfrm. HotelNoEdt. Text;
If setfrm. Prefixcheck. Checked=true then
Messtr:=messtr + setfrm. HotelSignatureEdt. Text; ;
Try
Fitem:=tsendListV. Items. The Add;
With DataAPPCenter. AdoResultNum do
The begin
The close;
SQL. The Clear;
SQL. The Add (' Insert into SendFcsM ([InfoId], [ID], [SendFcsMobile], [SendFcsStr], [SendStatus], [TaskState], [readState], [No], [AddTime]) values (NEWID (), 0, ' '+ MobileID +' ' ', ' '+ Messtr +' ' ', 0,0,1,0, GETDATE ()) ");
InsertNum:=execsql;
If (InsertNum> 0) then
The begin
Fitem. ImageIndex:=2;
WriteLogInfo (true, 'SendFcsTaskAPPFaile: Mobile=' + MobileID + '; '+'. SendContent='+ Messtr)
End the else
The begin
Fitem. ImageIndex:=0;
DataConnTime. Enabled:=true;
Self. SendAlarm (MobileID, Messtr);//replacement text messages to mobile phone
WriteLogInfo (true, 'SendFcsTaskSuccess: Mobile=' + MobileID + '; '+'.='+ Messtr SendContent);
end;
end;
Except,
Fitem. ImageIndex:=0;
DataConnTime. Enabled:=true;
Self. SendAlarm (MobileID, Messtr);//replacement text messages to mobile phone
WriteLogInfo (true, 'SendFcsTaskSuccess: Mobile=' + MobileID + '; '+'.='+ Messtr SendContent);
end;
Fitem. SubItems. Add (MobileID);
Fitem. SubItems. Add (Messtr);
Fitem. SubItems. Add (datetimetostr (now ()));
end;

end;

CodePudding user response:

Self. SendAlarm (MobileID, Messtr);//replacement text messages to mobile phones have any time this sentence has been measured,
An average of five times per second, that is to say, you stick a function to run about 5 times per second, finish every 200 milliseconds to run

CodePudding user response:

Should be after you receive the treatment is too time-consuming, don't say 1 second article 10, is a second article 100 will not card

CodePudding user response:

Texting is slow or write database slow?

CodePudding user response:

Build a list of data cache, the data received first list, and then open a thread processing data according to the order
  • Related