Solved

Reading the data over any communication media using Indy components in delphi

Posted on 2006-11-14
4
241 Views
Last Modified: 2010-04-05
Hi,
   I've two applications running at two different systems.One is using TCPClient and another is using TCPServer component.TCPClient is writing some data to TCPServer using write(not writeln) method.This write cannot be changed as per my requirement.Any type(text or binary) and any length of data can be written to Server end.Now my problem is that how can I read that data as it is at the server end because here ReadLn mehtod is not working.
0
Comment
Question by:Asmitagoyal
4 Comments
 
LVL 28

Accepted Solution

by:
2266180 earned 125 total points
ID: 17937507
well ... you will have to do some changes on the client, like it or not.

there is no way on the server side to know how much data to read. what you can do, is read 1 char until timeout, but that means that on client side you must wait some time after you sent something.

best way if you don't want to writeln on client side would be to
on client:
writeinteger(length(string));
write(string);

on server
l:=readinteger;
string:=readstring(l);
0
 
LVL 4

Assisted Solution

by:Meldrachaun
Meldrachaun earned 125 total points
ID: 17943458
The other solution is to send some kind of control character(s) to indicate the end of the data.  That's all writeln is doing, sending carriage return / line feed characters.  
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21250285
Forced accept.

Computer101
EE Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

23 Experts available now in Live!

Get 1:1 Help Now