Delphi with Indy 10 - Best approach for TCP communication -


i creating client-server application using delphi xe3 , indy 10 (idtcpserver , idtcpclient).

server side show connected clients, , can select clients on list , send them commands or streams/files. created message queue, sugested mr. remy lebeau. here doing:

enter image description here

what know is:

  1. is approach trying do?

  2. when 1 side starts read/writing, expects other side write/read? if other side can't? supose server requests file, doesn't exists, must client write "empty" stream anyway avoid problems?

btw, can't find example of (indy 10 tcp communication), using queue, error handling, etc. on indy's website there many broken links. can sugest me website examples?

thanks help!

when 1 side starts read/writing, expects other side write/read? if other side can't? supose server requests file, doesn't exists, must client write "empty" stream anyway avoid problems?

make client send reply accepting/rejecting request before file can transferred. make receiver send reply after transfer finished sender knows whether whole file received or not on receiver's end.

server: send file client: ok server: filestream client: ok 

server: send me file client: ok client: filestream server: ok 

server: send file client: not ready 

server: send me file client: not found 

server: send me file client: ok client: filestream (error midway) server: failed 

with said, since server 1 sending commands client, consider using tidcmdtcpclient on client side instead of tidtcpclient. provide dedicated thread receive server commands, , can create oncommand handlers commands , use provided tidcommand objects send replies.

consider using tidtcpconnection.sendcmd() method send commands , read initial responses, , tidtcpconnection.getresponse() read final responses.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -