title: Android Client, Pc Server Socket d'ont work over 3g
body: <p>I try to create a client server socket beetwen my droid(client) and my PC(server), when i am in local(over wifi) it work perfectely, but when il try over 3G i get this exception when the server try to get clientsocket.getOutputStream()</p>
  
  <pre><code>at java.lang.Thread.run(Unknown Source)
  java.net.SocketException: Connection reset
  at java.net.SocketInputStream.read(Unknown Source)
  at java.net.SocketInputStream.read(Unknown Source)
  at java.io.DataInputStream.readUnsignedShort(Unknown Source)
  at java.io.DataInputStream.readUTF(Unknown Source)
  at java.io.DataInputStream.readUTF(Unknown Source)
  </code></pre>
  
  <p>What's the probleme, do eny one know the solution of this?
  help please :-(</p>
  
  <p>The Server</p>
  
  <pre><code>public class Server {
  
  ServerSocket serverSocket;
  public LinkedBlockingQueue&lt;CDRecCourseDisplay&gt; recCours;
  public LinkedList&lt;ClientMail&gt; clientMails;
  static Server server;
  
  public static Server getInstance(){
      if(server == null){
          server = new Server();
      }
      return server;
  }
  
  Server() {
      // TODO Auto-generated constructor stub
      try {
          serverSocket = new ServerSocket(54444);
          recCours = new LinkedBlockingQueue&lt;CDRecCourseDisplay&gt;(10);
          clientMails = new LinkedList&lt;ClientMail&gt;();
      } catch (IOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
      }
      this.start();
  }
  
  private void start(){
      new Thread(new Runnable() {
          @Override
          public void run() {
              // TODO Auto-generated method stub
              while (true){
                  try {
                      Socket socket = serverSocket.accept();
                      new Thread(new Client(socket)).start();
                  } catch (IOException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                  }
  
              }
          }
      }).start();
  }
  
  class Client implements Runnable{
  
      Socket socket;
      DataInputStream in;
      DataOutputStream  out;
  
      public Client(Socket socket) {
          // TODO Auto-generated constructor stub
          this.socket = socket;
          if(socket == null) return;
          try {
              InputStream i = socket.getInputStream();
              OutputStream o = socket.getOutputStream();
              in = new DataInputStream(i);
              out = new DataOutputStream(o);
  
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
      }
  
      @Override
      public void run() {
          // TODO Auto-generated method stub
          new Thread(new Runnable() {
  
              @Override
              public void run() {
                  // TODO Auto-generated method stub
                  while(true){
                      try {
                          out.writeUTF("Test Message");
                      } catch (InterruptedException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      } catch (IOException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      } 
                  }
              }
          }).start();
  
          new Thread(new Runnable() {
  
              @Override
              public void run() {
                  // TODO Auto-generated method stub
                  while(true){
                      try {
                          String buf = in.readUTF();  
                          Log.d("MESSAGE", buf);
                      } catch (IOException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      } 
                  }
              }
          }).start();
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and the client</p>
  
  <pre><code>class Client implements Runnable{
  
      Socket socket;
      DataInputStream in;
      DataOutputStream  out;
  
      public void run() {
          // TODO Auto-generated method stub
          boolean conected = false;
          while(!conected){
              try {
                  Thread.sleep(500);
                  socket = new Socket("213.233.216.25", 54444);
                  in = new DataInputStream(socket.getInputStream());
                  out = new DataOutputStream(socket.getOutputStream());
                  conected = true;
              } catch (UnknownHostException e) {
                  // TODO Auto-generated catch block
                  Log.e("ERROR :", e.getMessage());
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  Log.e("ERROR :", e.getMessage());
              } catch (InterruptedException e) {
                  // TODO Auto-generated catch block
                  Log.e("ERROR :", e.getMessage());
              }
          }
  
          new Thread(new Runnable() {
  
              public void run() {
                  // TODO Auto-generated method stub
                  while(true){
                      try {
                          String buf = in.readUTF();
                          log.d("MESSAGE", buf);
                          }
                      } catch (IOException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      }
                  }
              }
          }).start();
  
  
          new Thread(new Runnable() {
  
              public void run() {
                  // TODO Auto-generated method stub
                  while(true){
                      try {
                          out.writeUTF("Test message from the phone");
                      } catch (InterruptedException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      } catch (IOException e) {
                          // TODO Auto-generated catch block
                          e.printStackTrace();
                      }
                  }
              }
          }).start();
      }
  }
  </code></pre>