 |
No?Ya! |
il supercoatto

Registered: Oct 2002
Posts: 187 (0.02 al dì)
Location: Berghèm
Corso: Tecnologie Della Comunicazione
Anno: ...fuori corso...
Time Online: 1 Day, 9:55:47 [...]
Status: Offline
Edit | Report | IP: Logged |
[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
|