What is the acceptable range of port numbers which can be passed to
new DatagramSocket(n) in Android SDK?

800 fails (not suprisingly, less than 1024)
1075 succeeds
1999 succeeds
9999 fails
30230 fails

And yes, my manifest requests INTERNET permission :)

Code example below, any clues appreciated...

package com.mese.hello;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import java.net.DatagramSocket;
import java.net.SocketException;

public class MeseHelloAndroid extends Activity {
        protected DatagramSocket s = null;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TextView tv = new TextView(this);
        try {
            s = new DatagramSocket(1999);
            tv.setText("Mese Says, 'Socket Created.'");
        } catch (SocketException e){
                tv.setText("Mese Says, "+e.toString());
        }
        /* setContentView(R.layout.main); */
        setContentView(tv);
    }
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to