Solved

TServerSocket - file via sendbuf or Text via sendtext ?

Posted on 2016-10-11
1
66 Views
Last Modified: 2016-10-12
How will TServerSocket's OnRead recognize if TClientSocket  has send file via sendbuf or Text via sendtext ?
0
Comment
Question by:Allan_Fernandes
1 Comment
 
LVL 26

Accepted Solution

by:
Sinisa Vuk earned 500 total points
ID: 41839082
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

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi Form ownership 4 115
How to debug For loops? 3 57
Base1 Encode/Decode 3 82
Browsing a TTreeView in Delphi 5 9
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question