×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Camilo Sampedro
Added: Apr 8, 2015 6:31 PM
Views: 15
  1. public Object[] listen() throws SocketException, IOException {
  2.         System.out.println(LanguagesController.getWord("ListenerMessage"));
  3.         Socket socket = serverSocket.accept();
  4.         PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
  5.         BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
  6.         InetAddress senderIP = socket.getInetAddress();
  7.         String message = in.readLine();
  8.         System.out.println(LanguagesController.getWord("Client") + ":" + senderIP + LanguagesController.getWord("Message") + ":" + message);
  9.         Object[] returnArray = {senderIP, recoverSendable(message)};
  10.         return returnArray;
  11.     }