Android Open Source - Android-Wireless Server






From Project

Back to project page Android-Wireless.

License

The source code is released under:

MIT License

If you think the Android project Android-Wireless listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.Nimble.Server;
// w w w  . j a va2 s.c o m
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

import android.util.Log;

/**
 * Class to start a pingback server on a given port.
 * @author Michael Leith
 *
 */
public class Server extends Thread{

  private static int port;
  private ServerSocket serverSocket;
  
  public Server(final int portAddress) { port = portAddress; }
  
  public void run()
  {
    try 
    {
      serverSocket = new ServerSocket(port);
      for(;;)
        new ThreadHandler( serverSocket.accept() ).start();
    } 
    catch (IOException e) { Log.e(this.getClass().toString(), e.toString()); }
  }
  
  class ThreadHandler extends Thread
  {
    Socket socket;
    
    public ThreadHandler(Socket s) { socket = s; }
    
    public void run()
    {
      try{
        
        // Read
        byte[] input = Sockets.read(socket);
        
        // Reply
        Sockets.write(socket, input);
              
              socket.close();
      }
      catch (Exception e)
      { Log.e("Client Thread", e.toString()); }
    }
  }
}




Java Source Code List

com.Nimble.Server.ServerActivity.java
com.Nimble.Server.Server.java
com.Nimble.Server.Sockets.java
com.Nimble.WifiAP.ClientInfo.java
com.Nimble.WifiAP.ClientScanner.java
com.Nimble.WifiAP.HardwareStateManager.java
com.Nimble.WifiAP.MainWiFiAPActivity.java
com.Nimble.WifiAP.WifiAP.java
com.Nimble.WifiAP.scanActivity.java
generics.Methods.java
generics.testingSuite.java