Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Oct : TCP clients and servers pushing data: how?

www.cryer.info
Managed Newsgroup Archive

TCP clients and servers pushing data: how?

Subject:TCP clients and servers pushing data: how?
Posted by:"Geppy Piloni" (nospam@nospam.com)
Date:Tue, 18 Oct 2005 16:09:19

Hi all,

I'm a newbie in TCP/IP programming and I still learning to use
multithreading, so I'm going to hurt myself implementing this
architecture using Indy 10 ;)

Some clients (call them data feeders) connect to a server (call it
data collector) and then start to push data to the server .
The server makes some calculations, change the data format and then
push the data to other clients to interact with users (call them GUI
clients).

The data pushed by data feeders to data collector are records (90/100
bytes, all clients will push a total of about 30 records every second,
with peaks of 50/60 recs/sec).
These record have 3 different structures.
The same amount of data will be pushed by the data collector to the
GUI clients.

The data feeders, the data collector and the client will be on
different machines on the same LAN, but in the future it will be
necessary to send data through Internet to GUI clients.

I already made some tests with Indy and a lot of search on the net,
but I'm still trying to solve these problems:

1)The data feeder TIdTCPClient connects to the data collector's
server,  send 2 or 3 text commands to tell the server which kind of
record it is going to send and then start to push the records to the
server.
In TIDTCPServer.OnExecute event, how can I understand if I'm receiving
a text command or a record?
How can I understand which record is contained in the buffer, maybe
reading the buffer lenght?
I could add some dummy fields to records to make all them with the
same dimension, but then I need to parse the buffer byte by byte to
figure out which record I'm dealing with.

2)The Data Collector will have a second TIdTCPServer to send data to
the GUI clients.
How can the GUI clients know the server is sending data to them, since
TIdTCPClient doesn't have an OnExecute event and the clients are not
soliciting data?

3)For this project I considered Indy and ICS libraries, but having no
experience  in TCP and Socket programming I'm not able to fully
evaluate them.
For the needs I just described, is one suite better than the other
one?

Thank you un advance for any suggestion.
--
Geppy

Replies:

www.cryer.info
Managed Newsgroup Archive