Solved

TServerSocket - file via sendbuf or Text via sendtext ?

Posted on 2016-10-11
1
31 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 25

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now