Solved

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

Posted on 2006-11-14
4
247 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

726 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