Solved

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

Posted on 2006-11-14
4
239 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:
ciuly 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

706 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

18 Experts available now in Live!

Get 1:1 Help Now