I made TCP Socket Server application.
Embedded GSM module devices are connected with TCP/IP protocol on GSM Line and send about 140 bytes of data in per 1 minute. I parse this 140 bytes of data and save it in the database.
Sometimes all client are disconnected and the server app is locked(freeze) then the devices cannot reconnect. (All devices reconnect automatically if disconnected)
try
AContext.Connection.IOHandler.DefStringEncoding: = IndyTextEncoding_UTF8;
// clean buffer
SetLength (RCIdByte, 0);
// read incoming packet
AContext.Connection.IOHandler.ReadBytes (RCIdByte, -1);
IdTcpServer1.Contexts.Locklist;
if Length (RCIdByte)> 0 then
begin
...
//parse and insert into database
...
end;
finally
IdTcpServer1.Contexts.Unlocklist;
end;
by the way, Platform (Linux or Windows) Database server PostgreSQL(9,5 or 10), Database connection component uniDAC
Technically, it is as much as the number of local ports on the computer (65500+) but there are different situations in the live application environment.
Is the 1 minute period short? Total number of devices is now 4 but will be 500 or 1500 in the future