![]() |
Show 150 posts per page |
.dsy:it. (http://www.dsy.it/forum/)
- Reti di calcolatori (http://www.dsy.it/forum/forumdisplay.php?forumid=68)
-- [java] due esercizi non funzionanti! (http://www.dsy.it/forum/showthread.php?threadid=17708)
[java] due esercizi non funzionanti!
Posto un paio di esercizi che non vanno!
Se qualcuno ci vuol dare un'occhiata ben venga...
import java.io.*;
import java.net.*;
class ServerThread extends Thread{
Socket socketConnessione = null;
String testoServer = null;
public ServerThread(Socket socketCon, String text) throws Exception{
this.socketConnessione = socketCon;
this.testoServer = text;
}
public void run(){
try{
DataOutputStream testoOut = new DataOutputStream(socketConnessione.getOutputStream());
if (testoServer.equals(null)){
testoOut.writeBytes(testoServer+666);
}else{
testoOut.writeBytes(testoServer);
}
}catch(Exception e){}
}
}
class ServerConcorrente{
public static void main(String[] args) throws Exception{
ServerSocket servSock = new ServerSocket(6789);
while(true){
Socket socketConnessione = servSock.accept();
ServerThread serverAttivo = new ServerThread(servSock,args[0]);
serverAttivo.start();
}
}
}
in questo esercizio in fase di compilazione non mi sgama il costruttore... perchè?
L'uso sarebbe java ServerConcorrente StringaDaMandare
non sto a postare il client...
__________________
http://www.noya.it
--------
Delta9 Drum&Bass Crew
--------
Associazione Orange
Perchè il costruttore accetta una Socket mentre gli passi una ServerSocket
__________________
?
All times are GMT. The time now is 11:20. | Show all 2 posts from this thread on one page |
Powered by: vBulletin Version 2.3.1
Copyright © Jelsoft Enterprises Limited 2000 - 2002.