Re: Dynamic C to C Data Transfer
- From: rpbg123@xxxxxxxxx (Roland Pibinger)
- Date: Sat, 16 Dec 2006 21:09:53 GMT
On Sat, 16 Dec 2006 18:11:49 GMT, Tom wrote:
The scenario is: Several networked machines. Each performing stock....
analysis on individual or a small group of financial instruments and
then passing buy/sell instructions to an order placing machine.
Sort of like a common file shared by several computers and programs at
once?
From that I suppose you machines have access to a common (LAN)directory which they shall use to exchange data via files?
Several programs being able to simultaneously have open and to
have write privileges to a single file is not possible?
That depends on the file system (better assume nothing).
Even with the
usage of SEEK to the file end and flushing the buffer at each write
... two programs might be writing at the same time. Thus the single
file approach seems to this rookie as impossible.
Probably yes.
However, each
program on the server computer(s) could write to a specific file set
up for each financial instrument and the central computer could open,
read, and then close these files at a specified timed interval? The
reason to write to two files and thus duplicating the task is an
attempt to avoid timing conflicts.
I don't quite understand that. But let's assume we have 2 computers
(pc1, pc2) that have to exchange data via a common directory and shall
not disturb each other. I would define a name and behavior convention:
In the specified common directory pc1 opens only the file with the
name 'to_pc1.dat' and pc2 opens only the file 'to_pc2.dat'. To
exchange data between pc1 and pc2 the following steps need to be
performed:
- pc1 copies the data to the common directory with a temporary file
name
- after copying is finished pc1 renames the file to 'to_pc2.dat'
- pc2 opens (only!) the file 'to_pc2.dat' and changes it
- afterwards pc2 renames the file to 'to_pc1.dat'
- and so on
The point is that pc1 and pc2 never concurrently access (not even
read) the same file and that the rename() function is atomic. You need
to implement some sort of polling to make it work and the approach
isn't very fast. But everything can be done in Standard C (but you
should e.g. look for the sleep() function for polling).
Hope that's relevant to your problem,
Roland Pibinger
.
- Follow-Ups:
- Re: Dynamic C to C Data Transfer
- From: Kenny McCormack
- Re: Dynamic C to C Data Transfer
- References:
- Dynamic C to C Data Transfer
- From: Tom
- Re: Dynamic C to C Data Transfer
- From: Roland Pibinger
- Re: Dynamic C to C Data Transfer
- From: Tom
- Dynamic C to C Data Transfer
- Prev by Date: Re: Downloadable standards file?
- Next by Date: Re: Downloadable standards file?
- Previous by thread: Re: Dynamic C to C Data Transfer
- Next by thread: Re: Dynamic C to C Data Transfer
- Index(es):
Relevant Pages
|