Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Automatic File Transfer Across Net to web server-XML??

  • 11-02-2005 9:06pm
    #1
    Closed Accounts Posts: 1,541 ✭✭✭


    Hi Everyone,

    I have a HTML form to allow a user upload a file and I can transfer it ok to my web server when they press submit(Im using PERL).

    However I want the user to just give the upload name/path just once and I then want the contents of the file to be continuously transferred from the client's computer to my web server. I will be scanning the file on the web server end and taking action based on the contents of the file. I want to detect when the file changes.

    I need to continously receive a client's file on my server.

    How do I do this? I tried Meta Refresh but to no avail eventhough I saved the name of the file as a cookie I still keep getting no data? Would XML be a possibility?


    finnpark :)


Comments

  • Registered Users, Registered Users 2 Posts: 6,571 ✭✭✭daymobrew


    I will be scanning the file on the web server end
    You'll be monitoring the file on the client machine? How?

    In the normal scheme of things (where servers can't access data on client machines) I would set up some scheduled system on the client computer e.g. cronjob to upload the file when it changes.
    I can transfer it ok to my web server when they press submit(Im using PERL).
    I'm assuming that the perl script is on the web server.
    If it's a script on the client computer you could convert the script to a cron job which would check the file and upload when it changes. A data file would store info about the last uploaded files.

    /me can be safely ignored if I'm way off the mark.


  • Closed Accounts Posts: 1,651 ✭✭✭Enygma


    Sounds to me like HTTP isn't the right protocol for this at all. It's a stateless protocol, just passes data back and forth and forgets about it.
    Cookies are basically just a hack to give the impression of state.

    One way to do what you want (I think) would be to write a client application that watches a file for changes, and uploads the changes as they are made. You'll need to do some reading on networking code tho.


  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    Enygma wrote:
    Sounds to me like HTTP isn't the right protocol for this at all.
    Agreed, not that way around anyway.


  • Registered Users, Registered Users 2 Posts: 885 ✭✭✭clearz


    Enygma wrote:
    Sounds to me like HTTP isn't the right protocol for this at all.

    Not necessarly. Is it just the one file that needs to be transfered. HTTP is fine for this and will work behind most firewalls. Its the web browser idea that needs to be scraped. You will need to develop a simple client app that checks for changes in the file and then opens a HTTP connection to your perl script and uploads the file.


  • Closed Accounts Posts: 1,541 ✭✭✭finnpark


    Hi All,

    Thanks for all the advice so far.

    It doesn't necesarily have to be a file. Cookies would be even better.

    Basically what I will have is a speech recognition system , written in C, which will be an executable that will be downloaded onto the client's PC. I need to be able send one letter, number or word back to my host to indicate what word the user has spoken. Now I thought a file would be the way to go. But cookies or some other method would be better.

    If there was some way of placing a cookie in C or C++ I would be laughing?? Can I place a cookie on a client's computer when they run my executable on their machine. I could then continuously scan for this cookie using the PERL script on my web server.

    So basically I need to transfer info from an executable(C/C++) on the client's PC to my web server. This info needs to indicate one of 5 possible words eg a=forward, b=stop, c=reverse etc or 1,2,3 etc. I just need to be able to transfer a small bit of info. Is it difficult to open a web page from C??

    Thanks again,
    finn


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,426 ✭✭✭ressem


    Is this schoolwork or for work?
    If it's serious then you might want to consider getting your client to post the information, as polling clients won't be efficient.

    You're using perl on the server and c on the client.
    Perhaps using SOAP might be a solution for you?
    perl's soap::lite
    http://guide.soaplite.com/#writing%20a%20cgibased%20server

    and the C++ client,
    MS Soap toolkit perhaps
    http://www.topxml.com/soap/articles/vcsoap/

    or if portability or ms dislike is an issue,
    apache axis library for C++
    ws.apache.org
    download 1.4 final binary for windows and glace at the samples.

    Or plently of other versions out there.


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    I'd imagine the best way would be to use C/C++ to make a HTTP POST call. You can use this to make a call to your web server passing the data required. Your script on the server would, for all intents and purposes, think that it had just been called by a web browser passing form data.


  • Registered Users, Registered Users 2 Posts: 6,571 ✭✭✭daymobrew


    I need to be able send one letter, number or word back to my host to indicate what word the user has spoken.
    How about doing a 'GET' on a different URL for each word. a.html for forward, b.html for backwards etc. Make the files minute to be returned quicker.
    Then you can examine the logs to see what URLs were requested and therefore what words were spoken.

    Another option, because contacting the server could introduce a lot of lag in the program, would be to record data locally and POST it to the server at a later stage.
    Since I don't know how active the C app will be, it's hard for those replying to determine the best solution. HTTP may not be the best way.


Advertisement