1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtCopyActionPerformed
int selected = jTable2.getSelectedRowCount();
// for (int i=0; i<selected ; i++)
// {
//
// }
try
{
final Socket client=new Socket(InetAddress.getByName(txtIpS.getText()),1311);
final PrintWriter out = new PrintWriter(client.getOutputStream(),true);
final BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
new Thread(new Runnable()
{
public void run()
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
try
{
out.println("haloooooooo");
out.flush();
String reponse = in.readLine();
System.out.println("le serveur dit : "+reponse);
client.close();
}catch (Exception e){e.printStackTrace();}
}
});
}
}
).start();
}catch(UnknownHostException e) {
//System.err.println("Don't know about host: taranis.");
} catch (IOException e) {
// System.err.println("Couldn't get I/O for the connection to: taranis.");
}
} |
Partager