Results 1 to 10 of 10
  1. #1
    adumi is offline Member
    Join Date
    Apr 2010
    Posts
    5
    Rep Power
    0

    Default monitor the progress of sending a file to client

    I am using a Java module in Wowza server (rtmp protocol) to send a bytearray
    to the client application (AS3).
    I need to Monitor the download of this file and the client application(AS3) does not allow it: There is a known bug in AS3 that prevents access to the Loader class when uploading certain files, if the loading of the file has not completed.
    Would it be possible for the server side Java script to somehow send the client some information about the "sending" of the file ?
    Does someone have any other idea how I "help" the client get progress information ?
    The Java wowza module is using the following line to send the bytearray:

    Java Code:
    		sendResult(client, params, AMFDataByteArray.wrap(fileBytes));
    I will be grateful even for a general answer such as: Yes, it can be done and you should use the following mechanism, etc.
    Last edited by adumi; 04-17-2010 at 01:33 PM.

  2. #2
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Default

    Is the server provide an echo?

  3. #3
    adumi is offline Member
    Join Date
    Apr 2010
    Posts
    5
    Rep Power
    0

    Default

    Thank you Webuser for commenting, and sorry for delaying in response, I took some time to study your idea on Echo server over tcp/ip.

    Suppose I can arrange for an echo server, how can I use it to send the client information about the progress of transferring the file, please ?

    Thank you for your assistance !

  4. #4
    iluxa is offline Senior Member
    Join Date
    Mar 2010
    Posts
    266
    Rep Power
    5

    Default

    you could try to have override AMFData class to take an input stream instead of a byte array, override the stream so you're manually reading from the file and can keep track of how many bytes were requested...

  5. #5
    adumi is offline Member
    Join Date
    Apr 2010
    Posts
    5
    Rep Power
    0

    Default

    Thanks Iluxa, for your comment, I appreciate your assistance very much.
    Do you mean I shoud try to do that with AS3 or AS2 ? or with another language on client-side ?

  6. #6
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Lightbulb

    Quote Originally Posted by adumi View Post
    Thank you Webuser for commenting, and sorry for delaying in response, I took some time to study your idea on Echo server over tcp/ip.

    Suppose I can arrange for an echo server, how can I use it to send the client information about the progress of transferring the file, please ?

    Thank you for your assistance !
    Oh, wellcome back )
    It is quite easy. As soon as you upload a file you should make your server to send a message back like a 1/0 for example. Until the echo replies set your client JProgressBar or something keep active. Since you get reply stop your JProgressBar )
    echo server is much popular thing as for Java. I recomend a short code example. watch it
    Echo Server
    Last edited by Webuser; 04-23-2010 at 05:28 AM.
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  7. #7
    adumi is offline Member
    Join Date
    Apr 2010
    Posts
    5
    Rep Power
    0

    Default

    Hi Webuser,
    Many thankls for for the code !
    I`d like to present a real progress bar, with precentage.
    The Thing is that unless I miisunderstand you (and this is quite probable) the echo server can supply only the start and stop events and not a simulatneous continuous read out of the ammounts of bytes loaded. This 2 event option is already available to me in AS3, despite the bug.
    Do you think there is any way to make an Echo server actually report progress, no tonly start/End events ?

  8. #8
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Default

    I think you can simply use a non percent JProgressBar or if you really want to see % or something add a timer simulate some progress )
    actually the problem you describe is much familiar ) But if the upload was aborted your server echo should report it )
    So there should be noticed 3 upload steps

    1. Start upload
    2. Upload can be aborted (an error)
    3. success/unssuccess server echo
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  9. #9
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Lightbulb

    And moreover you can use some additional tricky formula to time your precentage till you wait an echo...

    Here is a short pseudocode

    lib java.util.Timer

    Java Code:
    percentage += second;
    
    progbar.setValue(percentage);
    
    //got echo
    
    progbar.setValue(100);
    I hope you got the idea )
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  10. #10
    adumi is offline Member
    Join Date
    Apr 2010
    Posts
    5
    Rep Power
    0

    Default

    Thanks Webuser,
    You know, If I get stuck eventually and lose all other hope this is what I`ll do.
    I can actually get even a rough estimate of the user`s bandwidth speed which will enable me to allow for a `guessed` progress bar.
    I`ll still make some more attempts to get the real thing, meanwhile, thanks for your help so far...

Similar Threads

  1. Sending Text File --- Server-To-Client
    By nigamsir in forum Networking
    Replies: 1
    Last Post: 03-08-2010, 03:45 PM
  2. Replies: 8
    Last Post: 02-18-2010, 12:54 PM
  3. Sending image file over serversocket to browser client
    By maheshsk in forum Web Frameworks
    Replies: 1
    Last Post: 12-10-2009, 02:39 PM
  4. How to use timer to monitor lengthy loop progress
    By JotaPe in forum New To Java
    Replies: 7
    Last Post: 06-26-2009, 06:14 AM
  5. Replies: 1
    Last Post: 02-10-2009, 09:16 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •