c/perl program to read and transfer data to the server.
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > c/perl program to read and transfer data to the server.




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    c/perl program to read and transfer data to the server.  
sam


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-15-05 10:49 PM

Hi Folks,

I am fairly new to programming and so would like to have the gurus to
help me in one of my programs. I need to create a program that will
read the data from a file in realtime and transfer the data to my
headoffice server. Here are the real steps :

1. Read the data from the file that is created by a  POS terminal in
real time. The program I write should know that there is a new data
appended to the transaction file.
2. Tranfer the new data in realtime to my headoffice server
3. On my headoffice server I need another program that will recognize
that a new data is coming and now it should read that data from the
send pc and write the data into the database.

Does anybody know how can i do the programming for the above
requirement.

Any help will be much appreciated,

thanx in advance,

Sam






[ Post a follow-up to this message ]



    Re: c/perl program to read and transfer data to the server.  
Gordon Burditt


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-15-05 10:49 PM

>I am fairly new to programming and so would like to have the gurus to
>help me in one of my programs. I need to create a program that will
>read the data from a file in realtime and transfer the data to my
>headoffice server. Here are the real steps :
>
>1. Read the data from the file that is created by a  POS terminal in
>real time. The program I write should know that there is a new data
>appended to the transaction file.
>2. Tranfer the new data in realtime to my headoffice server
>3. On my headoffice server I need another program that will recognize
>that a new data is coming and now it should read that data from the
>send pc and write the data into the database.

The approach I would take would be:

Open a connection to the database;
Open the transaction file;
If appropriate, seek in the transaction file to the end or
to after the last transaction that got stored.
while (1) {
Try to read a record from the transaction file;
If you got EOF, sleep a while waiting for a transaction;
If you got a record, use the connection to the database
to enter the record;
}

I'm assuming the program you need in #3 *IS* the database, and the
API it uses is the way to do a realtime transfer in #2.  Many
databases, e.g. MySQL, Oracle, and Postgresql, accept network
connections and have clients you can link with C programs.

The time you sleep should be enough to avoid a lot of "busy waiting"
but not so long it slows down getting transactions to the database,
and depends somewhat on the transaction rate.  A few seconds might
be appropriate.

You need to figure out how to start this thing.  If when you start
it, all transactions in the transaction file are fresh, start at
the beginning.  If you keep track of how far you got, start where
you left off.  If all transactions are presumed stale, seek to the
end of the file first (although that would seem to risk missing a
transaction or two).  Or, if there's a cheap but foolproof way to
detect a duplicate transaction, use that.

Gordon L. Burditt





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:34 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register