
Originariamente inviata da
signfra
Allora all'interno del metodo
public void actionPerformed(ActionEvent e) {
devo aggiungere un IOException sennò non parte un metodo.
il metodo da eseguire all'interno della funziona sarebbe il seguente. il problema senza il try catch mi dice che devo aggiungere IOException con try catch ma mettendolo all'interno del try catch il metodo non parte.
codice:
public void insert(String Nome,String Cognome,String Codice,String Email)throws IOException{
final int SBAP_PORT = 8888;
Socket s = new Socket("localhost", SBAP_PORT);
InputStream in = s.getInputStream();
OutputStream out = s.getOutputStream();
BufferedReader reader = new BufferedReader(
new InputStreamReader(in));
PrintWriter writer = new PrintWriter(out);
String command = Nome;
System.out.print("Sending: " + command);
writer.print(command);
writer.flush();
s.close();
}