TServerSocket - file via sendbuf or Text via sendtext ?

How will TServerSocket's OnRead recognize if TClientSocket  has send file via sendbuf or Text via sendtext ?
Allan_FernandesAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Sinisa VukConnect With a Mentor Commented:
There is no internal logic... You should use own logic. All what is send through tcp/sockets is a bunch of bytes...So, on each "packet" you send - set first byte to something (ex. $01 + length of data) what will represent common text, otherwise set o something else (ex. $02 + length of data) before you send file data. On server side revers logic. Read first byte and second few bytes for length of data. After that read exact amount of data (keep reading more blocks if whole length is not read)
0
All Courses

From novice to tech pro — start learning today.