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
| import java.net.*;
import java.io.*;
public class clientbis
{
private ObjectOutputStream output;
private ObjectInputStream input;
public clientbis()
{
String serveur="JESSICA"; //Nom du server
try
{
Socket soc = new Socket(serveur, 5000);
output=new ObjectOutputStream(soc.getOutputStream());
output.flush();
input=new ObjectInputStream(soc.getInputStream());
voiture V1 = new voiture(2,2,2,2,true);
try{V1=(voiture)input.readObject();}
catch(ClassNotFoundException e)
{System.err.println(e.getMessage());}
soc.close();
}
catch(UnknownHostException e)
{ System.out.println("le nom du serveur est inconnu"); }
catch(IOException e)
{ System.out.println("Erreur entree/sortie pendant la connexion"); }
}
public static void main(String args[])
{ clientbis test = new clientbis(); }
} |