agreed,
I had this problem too.

In my opinion, this should certainly be mentioned in
http://code.google.com/android/reference/java/net/ServerSocket.html

so that people don't have to search for "unknown error" which
was the exception i got when trying to do ServerSocket(22322).


setting this permission made this work though


On Sep 16, 12:10 am, Salomon <[EMAIL PROTECTED]> wrote:
> OK, I got the awnser :
> I had to set the android.permission.INTERNET permission.
>
> But it took me a certain time to find this solution. I couldn't find
> any place on the android documentation telling that I needed to set
> this permission to use the Socket.
> Is there a place where it is explained what each permission is for ?
>
> Thank you !
>
> On 15 sep, 22:08, Salomon <[EMAIL PROTECTED]> wrote:
>
> > Hi folks !
> > I've just startied programming for Android with the 0.9 beta emulator.
> > I have read that to connect to a host application, I need to put the
> > 10.0.2.2 ip.
>
> > On host side, I use Netcat with the following command line :
> > netcat -L -p 2142
> > When I check with "telnet localhost 2142", it works.
>
> > Here is the code I'm running on the android side :
> >         public void onCreate(Bundle savedInstanceState)
> >         {
> >                 super.onCreate(savedInstanceState);
> >                 setContentView(R.layout.main);
>
> >                 try
> >                 {
> >                         Socket s = new Socket("10.0.2.2", 2141);
> >                         PrintWriter out = new 
> > PrintWriter(s.getOutputStream(), true);
> >                         out.println("It works !");
>
> >                         
> > ((TextView)findViewById(R.id.tv)).setText(R.string.success);
> >                 }
> >                 catch (UnknownHostException e)
> >                 {
> >                         Log.d("SoControl", "UnknownHostException : " +
> > e.getLocalizedMessage());
> >                 }
> >                 catch (IOException e)
> >                 {
> >                         Log.d("SoControl", "IOException : " + 
> > e.getLocalizedMessage());
> >                 }
> >         }
>
> > It's pretty simple, I just try to open a Socket and write "It works !"
> > on it.
> > The problem is that I always get a IOException.
> > I have tested this on a windows AND on a Linux. Both times I get the
> > same error.
>
> > I believe I don't have to make a redirection because I'm trying to
> > make android connecting to it's host.
> > I'm completely blocked since this connection is the basics of my soft.
>
> > Could anyone help me ?
>
> > Thanks !

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
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