Solved

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

Posted on 2006-11-14
4
244 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi inherited method 6 76
I want to use librsync in my Delphi backup application. 3 59
Breakpoint doesn't stop in my variable 3 30
DBCtrlGrid, Delphi, Scroll 7 26
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

861 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