8 Replies Latest reply on Mar 15, 2008 9:23 AM by 807591

    Simple Send File

    807591
      Im fairly new to Java so go easy on me please :)

      Im developing a small Java applet to run on browsers, One of the features is to enable access to a particular file on the users machine which is being saved/downloaded.

      How do i have the Java applet listen for connections on port e.g. 4050 and then have the file sent?
      The file has no size as it is being actively written.

      I have a hitch that this may require Java Socket but i may be wrong..

      Please help!
        • 1. Re: Simple Send File
          807591
          dudelancer wrote:
          Im fairly new to Java so go easy on me please :)

          Im developing a small Java applet to run on browsers, One of the features is to enable access to a particular file on the users machine which is being saved/downloaded.
          This is typically a no-no. You could potentially do file access on the user's machine if you disabled security, but most users would not be too happy about that.
          How do i have the Java applet listen for connections on port e.g. 4050 and then have the file sent?
          The file has no size as it is being actively written.

          I have a hitch that this may require Java Socket but i may be wrong..

          Please help!
          What are you true requirements here? Are you sure you need an Applet in the first place?
          • 2. Re: Simple Send File
            807591
            The user is aware of everything, Its not what you may be thinking.
            And yes a applet is required!
            • 3. Re: Simple Send File
              DrClap
              dudelancer wrote:
              Im developing a small Java applet to run on browsers, One of the features is to enable access to a particular file on the users machine which is being saved/downloaded.
              Does this mean the applet is downloading it? Or that something else is downloading it and the applet wants to monitor that process? Or that it has already been downloaded by something else?
              How do i have the Java applet listen for connections on port e.g. 4050 and then have the file sent?
              Use a ServerSocket. Presumably these connections will be coming from some other machine somewhere. As for having the file sent, does that mean the applet would be sending the file to that other machine, or that other machine would be sending the file to the applet?
              The file has no size as it is being actively written.
              No idea what that means.
              I have a hitch that this may require Java Socket but i may be wrong..
              The problem is not so much that you are new to Java, it is that you are new to designing computer applications. Don't start anything until you have a clear description of the requirements.
              • 4. Re: Simple Send File
                807591
                The file has no size as it is being actively written.
                No idea what that means.
                I think OP means that the file size isn't known until the write to the client is completed. Probably doesn't matter anyway.
                • 5. Re: Simple Send File
                  807591
                  The applet is downloading a file onto the local machine. That same file needs to be served locally from http://localhost:4000

                  Edit:
                  Thats exactly what i meant wpafbuser1

                  Edited by: dudelancer on Mar 14, 2008 10:51 AM
                  • 6. Re: Simple Send File
                    807591
                    Any ideas guys?
                    • 7. Re: Simple Send File
                      DrClap
                      dudelancer wrote:
                      The applet is downloading a file onto the local machine.
                      Okay. So the applet writes a file to the local file system.
                      That same file needs to be served locally from http://localhost:4000
                      Okay. So this client machine also has an HTTP server running on it, and also somebody is running a browser that contains the applet. That HTTP server is nothing to do with the applet.

                      Unless the applet itself contains the HTTP server. Stranger things have been written, I suppose. Was your question anything to do with that?
                      • 8. Re: Simple Send File
                        807591
                        Okay. So the applet writes a file to the local file system.
                        Yes the applet is writing a file onto the system. ( < Iv accomplished this part)
                        That same file needs to be accessible from a browser so I suggested that the file is served through a HTTP protocol. This is what im trying to accomplish