[java] due esercizi non funzionanti!
Posted by No?Ya! on 01-03-2005 10:41
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...
Powered by: vbHome (lite) v3.8 and vBulletin v2.3.1
Copyright © 2000 - 2002 Jelsoft Enterprises Limited