Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

TServerSocket - file via sendbuf or Text via sendtext ?

Posted on 2016-10-11
1
Medium Priority
?
132 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 28

Accepted Solution

by:
Sinisa Vuk earned 2000 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

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Screencast - Getting to Know the Pipeline
Suggested Courses

810 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