Results 1 to 5 of 5
  1. #1
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Exclamation Moving a file from a client to server (and vise versa)

    In a LAN set-up, Is this possible that a server queed with 100 clients can send a file to all clients? (not worrying about the network limit or traffic)

    Also, Could a client could send a file to the server? How about if 2 clients have to send different file (for example a .docx format) to one server.

    Note: I am planning to have the connection between terminals multi-threaded. So that by any number of request, nothing could be lost.

    Is the following possible? Kindly critic.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    5

    Default

    I'm not sure what is meant by having a server "queued" with 100 clients. did you mean that there are currently 100 clients connected to the server at this time. Certainly, it would in theory be possible to have a mechanism where by it did a brute force for each client, copy the file over the connection. where the appearance of having more than one client fed a file at once could be achieved with the use of more worker threads, since the file is presumably static right, so it would be threadsafe to read it many times from different fileinput stream handles.
    Now, if we wanted to have the same content sent to many clients apparently at the same time, like a kind of a streaming broadcast, I would wonder if investigating a Multicast transport would be more better suited.

    For having clients send to a server, in HTTP and Servlets anyway, yes. this is possible, because each "request" is handled within the servlet container by its own thread. as long as you built your file receiver servlet handler in the server side to be thread safe, using unique temporary files to store the in progress uploaded files, then many concurrent client to server file sendings are possible. Note however there is the paradox of what happens when two different clients would attempt to upload to the same file in the server, if we do a temporary file while uploading and then copy the file into place, we would have the last one finished winning, unless we did a check that the file suddenly exists after the second one was finished uploading but before we copied the temporary file into place, which we could notify the sender the file exists and ask them what to next.

  3. #3
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    Of i see.
    But is there a API on java that could copy the file (of all formats) to one directory.
    I was planning only to send the address of the file over the LAN then the server will do a thread copy on the application (on Java).
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  4. #4
    ramanna is offline Member
    Join Date
    Jul 2010
    Posts
    1
    Rep Power
    0

    Default

    i am also need the same i.e.remote files shuld be need to move in java i know ip address of that system in lan please do needfull thing to me please send to my mail rams.mca2006@gmail.com Thanks in advance

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,535
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by chyrl View Post
    But is there a API on java that could copy the file (of all formats) to one directory.
    I was planning only to send the address of the file over the LAN then the server will do a thread copy on the application (on Java).
    You need some form of 'command structure', i.e. the client (or the server) has to know that it is about to receive a file (or whatever). The connection between a client and a server is just a connected socket (I presume) and that socket doesn't know anything about files (or whatever). There is no magic involved. Think about this 'command structure' or 'protocol' you want to use first; only then start the boring coding of it all. File formats don't matter because at the lowest level they're all just a bunch of bytes.

    kind regards,

    Jos

Similar Threads

  1. To transfer a file from client to server
    By phani in forum Networking
    Replies: 4
    Last Post: 10-12-2010, 06:15 PM
  2. File transfer from Client to server
    By xemeGa in forum New To Java
    Replies: 0
    Last Post: 05-05-2010, 03:59 PM
  3. Replies: 8
    Last Post: 02-18-2010, 12:54 PM
  4. how to send mp3 file from server to client
    By Jigga008 in forum Networking
    Replies: 0
    Last Post: 12-01-2009, 12:02 PM
  5. Replies: 3
    Last Post: 07-29-2009, 04:52 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
  •