Android G1 ServerSocket I/O Errors on Creation
<p>So, I've been trying to learn a bit about programming for Android. I've got past "Hello, World!" and I've got GPS stuff to work.</p>

<p>I'm trying to have the device sit on a port and pipe GPS data over the port ( Eventually NEMA std, and have that talk with Marble for long drives )</p>

<p>It throws the I/O Error and Toast-s me "Ohh fuuuuu -- Can't create a GPS port on port 20017"</p>

<p>At first, I thought it was the port ( originally 2017 being normal user, might not have been able to create a reserved port ) but then I bumped it up to a very high number.</p>

<p>Here's what I've got so far:</p>

<pre><code>public class GeoLoc extends Activity {
    public void onCreate(Bundle savedInstanceState){
         super.onCreate(savedInstanceState);
         setContentView(R.layout.main);
         /* Use the LocationManager class to obtain GPS locations */
         LocationManager mlocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
         LocationListener mlocListener;
         int port = 20017;
         try {
             mlocListener = new MyLocationListener( port );
             mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, mlocListener);
         } catch (IOException e) {
             String Text = "Ohh fuuuuu -- Can't create a GPS port on port " + port;
             Toast.makeText( getApplicationContext(), Text, Toast.LENGTH_SHORT).show();
         }
    }

    ...
     SNIP
    ...
    public class MyLocationListener extends Thread implements LocationListener {
        ServerSocket s;
        ArrayList&lt;ServerThread&gt; childs; 
        public MyLocationListener( int port ) throws IOException {
            this.s = new ServerSocket( port );
            this.start();
    }
    @Override
    public void run() {
        try {
            String Text = "Waiting on port " + this.s.getLocalPort();
            Toast.makeText( getApplicationContext(), Text, Toast.LENGTH_SHORT).show();

            Socket s = this.s.accept();
            this.childs.add(new ServerThread( s ) );
        } catch (IOException e) {
            // crap-tastic but managable.
        }
    }

    @Override
    public void onLocationChanged(Location loc) {
        for ( int i = 0; i &lt; this.childs.size(); ++i ) {
            this.childs.get(i).sendLoc(loc);
        }
    }
    ...
     SNIP
    ...
    }
}
</code></pre>

<p>Thanks, guys!</p>
