?
Solved

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

Posted on 2006-11-14
4
Medium Priority
?
248 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 500 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 500 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

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…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

801 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