Avatar billede aslan Nybegynder
22. august 2005 - 15:03 Der er 35 kommentarer og
1 løsning

Kan kun overfører ca. 30 kb over sockets

Jeg leger med overførsel af data fra en klient til en anden klient gennem en server. Det seer ud til at virke ca. de første 30 kb og så "hænger" den og kommer ikke videre. Hvis jeg f.eks har en fil på mindre end 30 kb så bliver hele filen overført fra en klient over til den anden klient, mens den hænger hvis filen er over de 30 kb.

Kan nogen komme med et bud til hvad der kan gå galt?

Jeg har ikke noget kode jeg kan vise frem nu, men kan gøre det når jeg kommer hjem...
Avatar billede arne_v Ekspert
22. august 2005 - 15:07 #1
det er lidt svært at diagnosticere uden at se send og receive kode

specielt while løkken der læser er interessant
Avatar billede aslan Nybegynder
22. august 2005 - 19:01 #2
her er der noget kode:-)

upload client:

    private void upload(File file){
       
        System.out.println("Starting UploadClientThread");
       
        try{
            InputStream is = new FileInputStream(file);
            long fileSize = file.length();
            System.out.println("Filesize is: "+fileSize);
            byte[] b = new byte[1000];
            int n;
            while((n = is.read(b)) >= 0) {
                fileSize = fileSize-n;
                System.out.println("sending: "+n+" left of file: "+fileSize);
                os.write(b, 0, n);
            }
            System.out.println("Finished sending file");
            os.close();
            is.close();
            socket.close();
        }catch(FileNotFoundException fe){
            fe.printStackTrace();
        }catch(IOException io){
            io.printStackTrace();
        }
    }


download client:

    private void download(){
       
        System.out.println("Starting DownloadClientThread");
        System.out.println("Saving file: "+file.toString());
        try{
            OutputStream os = new FileOutputStream(file);
            byte[] b = new byte[1000];
            int n;
            while((n = is.read(b)) >= 0) {
                System.out.println("receiving "+n);
                os.write(b, 0, n);
            }
            System.out.println("Finished receiving file");
            os.close();
            is.close();
            socket.close();
        }catch(FileNotFoundException fe){
            fe.printStackTrace();
        }catch(IOException io){
            io.printStackTrace();
        }
    }


uploadhandler (på server):

        while(true){
            try{
                Socket s = ss.accept();
               
                clientList.add(s);
               
                FileThread fileThread = new FileThread(s,this);
                fileThread.start();
               
            }catch(IOException io){
                io.printStackTrace();
            }
        }

FileThread (på server):

    public void run(){
       
        byte[] b = new byte[1000];
       
        try{
            while(true) {
               
                List<Socket> clientList = uh.getClientList();
                int n;
                while((n = is.read(b)) >= 0) {
                    System.out.println("send to clients "+n);
                    for(Socket socket : clientList){
                        if(socket != null && !socket.isClosed()){
                            OutputStream os =  socket.getOutputStream();
                            os.write(b, 0, n);
                        }
                    }
                }
               
            }
        }catch(IOException io){
            io.printStackTrace();
        }
    }
Avatar billede arne_v Ekspert
22. august 2005 - 19:20 #3
du kunne prøve med

os.flush();

i upload, men jeg tror ikke at det hjælper
Avatar billede aslan Nybegynder
22. august 2005 - 19:31 #4
stadigvæk samme resultat, her er output:

upload client:

Starting UploadClientThread
Filesize is: 103110
sending: 1000 left of file: 102110
sending: 1000 left of file: 101110
sending: 1000 left of file: 100110
sending: 1000 left of file: 99110
sending: 1000 left of file: 98110
sending: 1000 left of file: 97110
sending: 1000 left of file: 96110
sending: 1000 left of file: 95110
sending: 1000 left of file: 94110
sending: 1000 left of file: 93110
sending: 1000 left of file: 92110
sending: 1000 left of file: 91110
sending: 1000 left of file: 90110
sending: 1000 left of file: 89110
sending: 1000 left of file: 88110
sending: 1000 left of file: 87110
sending: 1000 left of file: 86110
sending: 1000 left of file: 85110
sending: 1000 left of file: 84110
sending: 1000 left of file: 83110
sending: 1000 left of file: 82110
sending: 1000 left of file: 81110
sending: 1000 left of file: 80110
sending: 1000 left of file: 79110
sending: 1000 left of file: 78110
sending: 1000 left of file: 77110
sending: 1000 left of file: 76110
sending: 1000 left of file: 75110
sending: 1000 left of file: 74110
sending: 1000 left of file: 73110
sending: 1000 left of file: 72110
sending: 1000 left of file: 71110
sending: 1000 left of file: 70110
sending: 1000 left of file: 69110
sending: 1000 left of file: 68110
sending: 1000 left of file: 67110
sending: 1000 left of file: 66110
sending: 1000 left of file: 65110
sending: 1000 left of file: 64110
sending: 1000 left of file: 63110
sending: 1000 left of file: 62110
sending: 1000 left of file: 61110
sending: 1000 left of file: 60110
sending: 1000 left of file: 59110
sending: 1000 left of file: 58110
sending: 1000 left of file: 57110
sending: 1000 left of file: 56110
sending: 1000 left of file: 55110
sending: 1000 left of file: 54110
sending: 1000 left of file: 53110
sending: 1000 left of file: 52110
sending: 1000 left of file: 51110
sending: 1000 left of file: 50110
sending: 1000 left of file: 49110
sending: 1000 left of file: 48110
sending: 1000 left of file: 47110
sending: 1000 left of file: 46110
sending: 1000 left of file: 45110
sending: 1000 left of file: 44110
sending: 1000 left of file: 43110
sending: 1000 left of file: 42110
sending: 1000 left of file: 41110
sending: 1000 left of file: 40110
sending: 1000 left of file: 39110
sending: 1000 left of file: 38110
sending: 1000 left of file: 37110
sending: 1000 left of file: 36110
sending: 1000 left of file: 35110
sending: 1000 left of file: 34110
sending: 1000 left of file: 33110
sending: 1000 left of file: 32110
sending: 1000 left of file: 31110
sending: 1000 left of file: 30110
sending: 1000 left of file: 29110
sending: 1000 left of file: 28110
sending: 1000 left of file: 27110
sending: 1000 left of file: 26110
sending: 1000 left of file: 25110
sending: 1000 left of file: 24110
sending: 1000 left of file: 23110
sending: 1000 left of file: 22110
sending: 1000 left of file: 21110
sending: 1000 left of file: 20110
sending: 1000 left of file: 19110
sending: 1000 left of file: 18110
sending: 1000 left of file: 17110
sending: 1000 left of file: 16110
sending: 1000 left of file: 15110
sending: 1000 left of file: 14110
sending: 1000 left of file: 13110
sending: 1000 left of file: 12110
sending: 1000 left of file: 11110
sending: 1000 left of file: 10110
sending: 1000 left of file: 9110
sending: 1000 left of file: 8110
sending: 1000 left of file: 7110
sending: 1000 left of file: 6110

download client:

receiving 1000
receiving 1000
receiving 460
receiving 1000
receiving 460
receiving 1000
receiving 460
receiving 1000
receiving 460
receiving 1000
receiving 460
receiving 1000
receiving 460
receiving 1000
receiving 460
receiving 1000
receiving 460
receiving 1000
receiving 460
receiving 620
receiving 1000
receiving 460
receiving 1000
receiving 460
receiving 80
receiving 1000
receiving 460
receiving 540
receiving 1000
receiving 1000
receiving 460
receiving 540
receiving 1000
receiving 1000
receiving 1000
receiving 460
receiving 540
receiving 1000
receiving 460
receiving 540
receiving 1000
receiving 1000
receiving 460
receiving 540
receiving 1000
receiving 460
receiving 540
receiving 1000
receiving 1000

server:

send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 760
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000
send to clients 1000


Kan det være noget server/router opsætning?
Avatar billede arne_v Ekspert
22. august 2005 - 19:38 #5
os.flush();

bør også sættes ind i FileThread run
Avatar billede arne_v Ekspert
22. august 2005 - 19:38 #6
ved en "netværks/system fejl" burde du få en exception
Avatar billede aslan Nybegynder
22. august 2005 - 19:51 #7
Der er ingen fejl... den udskriver ovenstående og så står den bare og hænger
Avatar billede aslan Nybegynder
22. august 2005 - 19:55 #8
Skal lige høre når du skriver at jeg skal sætte os.flush(); ind mener du vel:

        try{
            InputStream is = new FileInputStream(file);
            long fileSize = file.length();
            System.out.println("Filesize is: "+fileSize);
            byte[] b = new byte[1000];
            int n;
            while((n = is.read(b)) >= 0) {
                fileSize = fileSize-n;
                System.out.println("sending: "+n+" left of file: "+fileSize);
                os.write(b, 0, n);
            }
            System.out.println("Finished sending file");
            os.flush();
            os.close();
            is.close();
            socket.close();
        }catch(FileNotFoundException fe){
            fe.printStackTrace();
        }catch(IOException io){
            io.printStackTrace();
        }
Avatar billede aslan Nybegynder
22. august 2005 - 19:56 #9
men problemet er jo at den aldrig bliver færdig med while løkken så den når vel ikke til os.flush()
Avatar billede arne_v Ekspert
22. august 2005 - 19:57 #10
nej

            while((n = is.read(b)) >= 0) {
                fileSize = fileSize-n;
                System.out.println("sending: "+n+" left of file: "+fileSize);
                os.write(b, 0, n);
                os.flush();
            }
Avatar billede aslan Nybegynder
22. august 2005 - 20:06 #11
desvære stadigvæk det samme....
Avatar billede krukken Mester
23. august 2005 - 00:37 #12
Hvilke sockets bruger du?
Avatar billede arne_v Ekspert
23. august 2005 - 08:19 #13
jeg fik lige en tanke - du sender til alle clients - inkluderer det upload client ?

hvis ja - læser den i en seperat tråd ? (og hvis nej til det spørgsmål så prøv det !)
Avatar billede aslan Nybegynder
23. august 2005 - 08:44 #14
Ja arne det giver mening, jeg prøver det lige når jeg kommer hjem.
Avatar billede aslan Nybegynder
25. august 2005 - 23:29 #15
efter en hård kamp lykkedes det :-) gider du at lægge et svar arne?
Avatar billede arne_v Ekspert
25. august 2005 - 23:31 #16
gerne

hvad skulle der til ?
Avatar billede aslan Nybegynder
26. august 2005 - 09:45 #17
At upload clienten sendte til alle clienter forbundet til serveren var noget jeg brugte fordi jeg i starten bare skulle have det til at virke. Men det bevirkede at uploaden ikke virkede som du oxo skrev fordi den sendte til sig selv. Da jeg løste det fandt jeg ud af at det stadigvæk ikke virkede, fordi at upload clienten begyndte at sende data, før download clineten havde forbundet sig til serveren. Derfor måtte jeg lave en løkke, der fik upload clienten til at vendte med at uploade filen, før download clienten havde forbundet sig. Og så lykkedes det, efter flere dags kamp :-)

For forståelsens skyld skal det lige siges at upload funktionaliteten bliver brugt i en chat og at det er derfor at der skal være en form for synkronisering mellem klienter før det kan virke.
Avatar billede aslan Nybegynder
31. august 2005 - 22:09 #18
Hej Arne

Nu er jeg imidlertidig løbet ind i et andet problem som jeg ikke kan
komme videre med. Første gang client a uploader en fil til klient b
går det fint, men gør den det anden gang får jeg en fejl. Men hvis
client a forsøger at uploade en fil til client c efter at have uploadet
til client b går det fint. Det er ligesomom at den ikke kan uploade
2 gange til samme client. Det virker selvfølgelig hvis jeg genstarter
client a.

Jeg giver 200 points hvis du kan give mig et hint der kan løse fejlen?



Her er noget udskrift:

første upload:

2005-08-30 22:19:27,328 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - Try to send
2005-08-30 22:19:27,328 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 16384
2005-08-30 22:19:27,343 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 9896
2005-08-30 22:19:27,625 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 16384
2005-08-30 22:19:27,687 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 11356
2005-08-30 22:19:27,781 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 10220
2005-08-30 22:19:27,859 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 5840
2005-08-30 22:19:27,906 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 4380
2005-08-30 22:19:27,968 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 8760
2005-08-30 22:19:28,062 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 16060
2005-08-30 22:19:28,156 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 8760
2005-08-30 22:19:28,234 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 7300
2005-08-30 22:19:28,250 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 4380
2005-08-30 22:19:28,328 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 11680
2005-08-30 22:19:28,468 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 16060
2005-08-30 22:19:28,609 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 16384
2005-08-30 22:19:28,718 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 14276
2005-08-30 22:19:28,843 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 14600
2005-08-30 22:19:28,968 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 16060
2005-08-30 22:19:29,093 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 16060
2005-08-30 22:19:29,187 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 5840
2005-08-30 22:19:29,281 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 16384
2005-08-30 22:19:29,281 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 1136
2005-08-30 22:19:29,437 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 16384
2005-08-30 22:19:29,546 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 9896
2005-08-30 22:19:29,656 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 16060
2005-08-30 22:19:29,781 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 16384
2005-08-30 22:19:29,812 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 9896
2005-08-30 22:19:29,937 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 16060
2005-08-30 22:19:30,078 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 16384
2005-08-30 22:19:30,171 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 9896
2005-08-30 22:19:30,312 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 16060
2005-08-30 22:19:30,437 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 16384
2005-08-30 22:19:30,484 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 11356
2005-08-30 22:19:30,593 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 11258
2005-08-30 22:19:30,671 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - Finished sending file
2005-08-30 22:19:30,671 INFO [Thread-6] dk.aslani.chat_server.control.FileThread - Closing socket connection....


anden upload:

2005-08-30 22:19:47,671 INFO [Thread-7] dk.aslani.chat_server.control.FileThread - Try to send
2005-08-30 22:19:47,687 INFO [Thread-7] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 4380
2005-08-30 22:19:47,750 INFO [Thread-7] dk.aslani.chat_server.control.FileThread - sending to *** bytes: 13140
2005-08-30 22:19:47,750 ERROR [Thread-7] dk.aslani.chat_server.control.FileThread - Error in sending file
java.net.SocketException: Software caused connection abort: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
at dk.aslani.chat_server.control.FileThread.run(FileThread.java:71)
2005-08-30 22:19:47,750 INFO [Thread-7] dk.aslani.chat_server.control.FileThread - Closing socket connection....


Og noget kode:

Uploadhandler(server):

    public void run(){
        while(true){
            try{
                Socket s = ss.accept();
               
                BufferedReader bf = new BufferedReader(new InputStreamReader(s.getInputStream()));
                String msg = bf.readLine();
                if(msg.startsWith("<download client>")){
                    String userName = msg.substring(17);
                    SocketClient client = new SocketClient();
                    client.setSocket(s);
                    client.setUserName(userName);
                    clientList.add(client);
                   
                    log.info("Download client connected, userName: "+userName);
                }
                //
                else if(msg.startsWith("<upload client>")){
                   
                    String data = msg.substring(15); 
                    String[] tokens = data.split(";");
                    String uploadClientName = tokens[0];
                    int fileSize = Integer.parseInt(tokens[1]);
                    FileThread fileThread = new FileThread(s, this, uploadClientName, fileSize);
                    fileThread.start();
                   
                    log.info("Upload client connected, ip: "+s.getInetAddress().getHostAddress());
                }               
               
            }catch(IOException io){
                log.error("Error in run",io);
            }
        }
    }

FileThread(Server):

    public void run(){
       
        SocketClient sc = null;
        int counter=0;
        while((sc=uh.getFileToClient(uploadClientName))==null){
            log.info("could not find uploadClient: "+uploadClientName+" - "+counter);
            counter++;
           
            try{
                //sleep 10 sec
                sleep(1000);
            }catch(InterruptedException e){
                log.error("Error in sleep of thread",e);
            }
            //stop waiting after 3 min.
            if(counter==180){
                log.info("Giving up to wait after 3 min. uploadClientName: "+uploadClientName);
                return;
            }
        }
       
        byte[] b = new byte[16384];
        try{
            int n;
            log.info("Try to send");
            long downloadedSize=0;
            Socket outSocket = sc.getSocket();
            if(outSocket != null && !outSocket.isClosed()){
                OutputStream os =  outSocket.getOutputStream();
                while((n = is.read(b)) >= 0) {
                    log.info("sending to "+sc.getUserName()+" bytes: "+n);
                    os.write(b, 0, n);
                    downloadedSize +=n;
                    if(fileSize<=downloadedSize){
                        break;
                    }
                }
                os.flush();
            }
            log.info("Finished sending file");
           
        }catch(Exception e){
            log.error("Error in sending file",e);
        } finally{
            if(!socket.isClosed()){
                log.info("Closing socket connection....");
                try{socket.close();}catch(IOException io){log.error("Error in closing socket",io);}
            }
        }
    }



DownloadClient:

    private void download(){
       
        System.out.println("Starting DownloadClientThread");
        System.out.println("Saving file: "+file.toString());
        try{
            OutputStream os = new FileOutputStream(file);
            byte[] b = new byte[16384];
            int n;
            long downloadedSize=0;
            while((n = is.read(b)) >= 0) {
                System.out.println("receiving "+n);
                os.write(b, 0, n);
                downloadedSize +=n;
                if(fileSize<=downloadedSize){
                    break;
                }
            }
            System.out.println("Finished receiving file");
            os.flush();
           
        }catch(FileNotFoundException fe){
            fe.printStackTrace();
        }catch(IOException io){
            io.printStackTrace();
        }finally{
            if(!socket.isClosed()){
                System.out.println("closing socket connection...");
                try{socket.close();}catch(IOException io){System.out.println("Error in closing socket\n"+io);}
            }
        }
    }
   
    public void run(){
        download();
    }




UploadClient:

    private void upload(File file){
       
        System.out.println("Starting UploadClientThread");
       
        try{
            InputStream is = new FileInputStream(file);
            long fileSize = file.length();
            System.out.println("Filesize is: "+fileSize);
            byte[] b = new byte[16384];
            int n;
            while((n = is.read(b)) >= 0) {
                fileSize = fileSize-n;
                System.out.println("sending: "+n+" left of file: "+fileSize);
                os.write(b, 0, n);
                os.flush();
            }
            System.out.println("Finished sending file");
        }catch(FileNotFoundException fe){
            fe.printStackTrace();
        }catch(IOException io){
            io.printStackTrace();
        }finally{
            if(!socket.isClosed()){
                System.out.println("closing socket connection...");
                try{socket.close();}catch(IOException io){System.out.println("Error in closing socket\n"+io);}
            }
        }
    }

    public void run(){
        upload(file);
    }
Avatar billede arne_v Ekspert
31. august 2005 - 22:15 #19
får upload client åbnet en ny socket for fil nummer 2 ?
Avatar billede aslan Nybegynder
31. august 2005 - 22:21 #20
Det vil jeg mene, dette udskrift er fra uplaod clienten efter 2 upload forsøg:


Starting UploadClientThread
Filesize is: 403094
sending: 16384 left of file: 386710
sending: 16384 left of file: 370326
sending: 16384 left of file: 353942
sending: 16384 left of file: 337558
sending: 16384 left of file: 321174
sending: 16384 left of file: 304790
sending: 16384 left of file: 288406
sending: 16384 left of file: 272022
sending: 16384 left of file: 255638
sending: 16384 left of file: 239254
sending: 16384 left of file: 222870
sending: 16384 left of file: 206486
sending: 16384 left of file: 190102
sending: 16384 left of file: 173718
sending: 16384 left of file: 157334
sending: 16384 left of file: 140950
sending: 16384 left of file: 124566
sending: 16384 left of file: 108182
sending: 16384 left of file: 91798
sending: 16384 left of file: 75414
sending: 16384 left of file: 59030
sending: 16384 left of file: 42646
sending: 16384 left of file: 26262
sending: 16384 left of file: 9878
sending: 9878 left of file: 0
Finished sending file
closing socket connection...




Starting UploadClientThread
Filesize is: 459049
sending: 16384 left of file: 442665
sending: 16384 left of file: 426281
sending: 16384 left of file: 409897
sending: 16384 left of file: 393513
java.net.SocketException: Software caused connection abort: socket write error
closing socket connection...
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
        at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)
        at dk.aslani.chat_client.control.UploadClientThread.upload(UploadClientThread.java:78)
        at dk.aslani.chat_client.control.UploadClientThread.run(UploadClientThread.java:107)
Avatar billede arne_v Ekspert
31. august 2005 - 22:27 #21
og download client ?
Avatar billede aslan Nybegynder
31. august 2005 - 22:28 #22
Jeg er villig til at sende koden til dig hvis du skulle have lyst til at kigge på det?
Avatar billede aslan Nybegynder
31. august 2005 - 22:29 #23
Starting DownloadClientThread
receiving 16384
receiving 1136
receiving 8760
receiving 16384
receiving 1136
receiving 9732
receiving 16384
receiving 16384
receiving 16384
receiving 12004
receiving 16384
receiving 8760
receiving 16384
receiving 7624
receiving 16384
receiving 16384
receiving 9896
receiving 15248
receiving 14924
receiving 9084
receiving 16384
receiving 4380
receiving 16384
receiving 1136
receiving 2920
receiving 16384
receiving 1136
receiving 7300
receiving 9732
receiving 16384
receiving 1136
receiving 5840
receiving 3568
receiving 13464
receiving 4380
receiving 11680
receiving 8760
receiving 4380
receiving 11986
Finished receiving file
closing socket connection...


Starting DownloadClientThread
Avatar billede arne_v Ekspert
31. august 2005 - 22:33 #24
så den modtager aldrig noget

er koden nem at builde & køre ?
Avatar billede aslan Nybegynder
31. august 2005 - 22:38 #25
Jep du starter dk.aslani.chat_server.control.Server for at køre serveren og dk.aslani.chat_client.view.AppletForm for at køre klienterne. Og der er brugt ant.
Avatar billede arne_v Ekspert
31. august 2005 - 22:40 #26
prøv og send den

arne_v@mail.danbbs.dk
Avatar billede aslan Nybegynder
31. august 2005 - 22:46 #27
fint :-)
Avatar billede aslan Nybegynder
31. august 2005 - 22:54 #28
Når arne jeg skal tidlig op imorgen, vender tilbage der...
Avatar billede aslan Nybegynder
01. september 2005 - 18:56 #29
Var koden til at gennemskue arne?
Avatar billede arne_v Ekspert
01. september 2005 - 19:25 #30
jeg startede med at ville køre det men havde visse problemer med det
Avatar billede arne_v Ekspert
01. september 2005 - 19:39 #31
server kører men client giver

run:

BUILD FAILED
C:\Chat\chat_client\nbproject\build-impl.xml:289: The following error occurred while executing this line:
C:\Chat\chat_client\nbproject\build-impl.xml:189: Classname must not be null.
Avatar billede arne_v Ekspert
01. september 2005 - 21:05 #32
jeg har prøvet at læs ekode, men det er ikke s¨dan lige at gennemskue

jeg tror at det er et socket/stream open/close problem

med bedste råd vil være at udskrive alle socket/stream open/close og
se om det matcher det som det skal være
Avatar billede arne_v Ekspert
01. september 2005 - 21:13 #33
mit gæt er at server anden hang sender på samme socket til client men at client har
lukket den og modtager på en ny socket
Avatar billede aslan Nybegynder
01. september 2005 - 22:07 #34
ok jeg prøver at kigge på det arne..
Avatar billede aslan Nybegynder
01. september 2005 - 22:35 #35
jamen for h.. arne du er jo genial..

mit gæt er at server anden hang sender på samme socket til client men at client har
lukket den og modtager på en ny socket  <-- lige præcis

første forsøg og det virkede :-)
Avatar billede aslan Nybegynder
01. september 2005 - 22:37 #36
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester