Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exchange Data between two apps across PC on LAN

I have a need of implementing two apps that will exchange data with each other. Both apps will be running on separate PCs which are part of a LAN.

How we can do this in Delphi?

Is there any free component which will make it easy to exchange data between apps across PCs?

like image 212
Yogi Yang 007 Avatar asked Aug 10 '09 12:08

Yogi Yang 007


3 Answers

If I'm writing it myself, I (almost) always use sockets to exchange data between apps.

It's light weight, it works well on the same machine, across the local network or the Internet with no changes and it lets you communicate between apps with different permissions, like services (Windows messages cause problems here).

It might not be a requirements for you, but I'm also a fan of platform independent transports, like TCP/IP.

There are lots of free choices for Delphi. Here are a few that I know of. If you like blocking libraries, look at Indy or Synapse. If you prefer non-blocking, check out ICS.

like image 175
Bruce McGee Avatar answered Sep 24 '22 15:09

Bruce McGee


Before you choose a technique, you should characterize the communication according to its throughput, granularity, latency, and criticality.

Throughput -- how much data per unit time will you need to move? The range of possible values is so wide that the lowest-rate and highest-rate applications have almost nothing in common.

Granularity -- how big are the messages? How much data does the receiving application need before it can use the message?

Latency -- when one aplication sends a message, how soon must the other application see it? How quickly do you want the receiving application to react to the sending application?

Criticality -- how long can a received message be left unattended before it is overrun by a later message? (This is usually not important unless the throughput is high and the message storage is limited.)

Once you have these questions answered, you can begin to ask about the best technology for your particular situation.

-Al.

like image 24
A. I. Breveleri Avatar answered Sep 22 '22 15:09

A. I. Breveleri


I used to use Mailslots if I needed to communicate with more than one PC at a time ("broadcast") over a network, although there is the caveat that mailslots are not guaranteed.

For 1-to-1, Named Pipes are a Windows way of doing this sort thing, you basically open a communication channel between 2 PCs and then write messages into the pipe. Not straight forward to start with but very reliable and the recommended way for things like Windows Services.

MS offer Named Pipes as an alternative way of communicating with an SQL Server (other than TCP/IP).

But as Bruce said, TCP/IP is standard and platform independent, and very reliable.

like image 23
J__ Avatar answered Sep 24 '22 15:09

J__