Results 1 to 1 of 1
  1. #1
    TerraViper-5 is offline Member
    Join Date
    Apr 2011
    Rep Power

    Unhappy Sending files over network

    Hello. I have made a simple server in java that sends requested files to clients via http://<ip>/<filename>. It creates a new thread for each client. The problem is the speed is limited to 100kBps per thread. I searched a little bit and I think I know the problem:

    Java Code:
    FileInputStream input = null;  
    DataOutputStream output = null;
    output = new DataOutputStream(client.getOutputStream()); //client = Socket
    input = new FileInputStream(requestedFile);
    int read;
            try {
                for(;;) {
                    read =;
                    if (read==-1) {
    I think the problem is because I write byte by byte and that is slow, I think I should use BufferedReader and Writer. And heres the problem: I dont know how to add those two. I tried a few things but I cant make it work. FileWriter just cant use client.getOutputStream() as parameter. Please, some help here. thanks.
    Last edited by TerraViper-5; 04-15-2011 at 08:30 PM.

Similar Threads

  1. sending and recieving files
    By rav in forum New To Java
    Replies: 9
    Last Post: 07-26-2010, 04:34 PM
  2. sending object through network/socket
    By skandalouz in forum Networking
    Replies: 1
    Last Post: 12-24-2009, 08:34 AM
  3. Sending a key over network
    By cst in forum Networking
    Replies: 0
    Last Post: 11-04-2009, 02:19 PM
  4. sending file over network
    By qwerty in forum Networking
    Replies: 6
    Last Post: 04-25-2009, 01:55 AM
  5. Sending .GIF files over the network
    By nadia in forum Networking
    Replies: 8
    Last Post: 12-30-2008, 12:57 PM

Posting Permissions

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