Question about ServerSocket

by riverwide » Sat, 15 Nov 2008 00:14:25 GMT


Sponsored Links
 Hi,

I want to new a ServerSocket instance.(java.net.ServerSocket) But I
can't.
A java.net.BindException was throws.(java.net.BindException:
Permission do not allow action on socket)

Is it possible to use the ServerSocket class in Android ?
I've found the ServerSocket page in API document.(http://
code.google.com/android/reference/java/net/ServerSocket.html)

Thank you for any pointers.

riverwide

--~--~---------~--~----~------------~-------~--~----~



Question about ServerSocket

by Alvin Yates » Sat, 15 Nov 2008 02:37:42 GMT


 If it's on the page, more than likely.  However, if you haven't set
your manifest file to add the NETWORK permission, that would do it
easily.



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Question about ServerSocket

by linker lv » Sat, 15 Nov 2008 07:19:46 GMT


 just need give the permission.
android.permission.INTERNET

2008/11/14 riverwide <[EMAIL PROTECTED]>


--~--~---------~--~----~------------~-------~--~----~



Question about ServerSocket

by 宸濋倞娉拌獙 » Mon, 17 Nov 2008 17:04:13 GMT


 Hi,

I had tried to give the permission "android.permission.INTERNET",
using telnet and execute a command "redir add tcp:400:400".
But, same exception "A java.net.BindException" was thrown.

It questions again.
Is it possible to use the ServerSocket class in Android ?

The following are my codes.
//! STR my code
try
{
    ServerSocket srvrSock = new ServerSocket(400);
}
catch(IOException e)
{
    e.printStackTrace();
}
catch(Exception e)
{
    e.printStackTrace();
}
//! END my code

Thank you for any pointers.

riverwide

--~--~---------~--~----~------------~-------~--~----~



Question about ServerSocket

by linker lv » Tue, 18 Nov 2008 09:45:01 GMT


 public static final int SERVERPORT = 4444;
public void server()
    {
     DataOutputStream os=null;
        DataInputStream is = null;
        ServerSocket socket = null;
        Socket ClientSocket = null;
        String out = null;
        try
        {
         socket = new ServerSocket(SERVERPORT);//10.0.2.2

         if(socket == null)
         {
          Log.d("TagServer()", "socket null");
         }
         else
         {
          Log.d("TagServer()", "Waiting...");
          ClientSocket = socket.accept();
                os = new DataOutputStream(ClientSocket.getOutputStream());
                is = new DataInputStream(ClientSocket.getInputStream());
                /* By magic we know, how much data will be waiting for us*/
                byte[] buf = new byte[100];
                int readLen = 0;
                while((readLen = is.read(buf, 0, 100)) != -1)
                {
                 out = new String(buf, 0, readLen-1);
                 Log.d("TCP", out);
                 os.writeBytes("end");
                }
                os.close();
                is.close();
                socket.close();
                ClientSocket.close();
                Log.d("TagServer()", "Finished");
         }
        }
        catch(Exception e)
        {
         System.out.println(e);
         Log.d("TagServer()", e.toString());
        }
    }

i think you can understand it.

2008/11/17  <[EMAIL PROTECTED]>


--~--~---------~--~----~------------~-------~--~----~



Question about ServerSocket

by Brian Manning » Tue, 18 Nov 2008 23:12:11 GMT


 


Does Android still adhere to the *NIX convention of only allowing the
root user to bind to ports 1-1024?  I'm not seeing anything in the
socket classes that is saying different, so I'm assuming this is the
case.  You might want to try binding your socket to a port above 1024
to see if that changes things.

Thanks,

Brian

--~--~---------~--~----~------------~-------~--~----~



Question about ServerSocket

by riverwide » Wed, 19 Nov 2008 12:48:46 GMT


 Hi,

Certainly, when the port of waiting for the server was assumed to be
"well known ports(0-1024)", the exception was thrown.

When I use a port above 1024, I was able to new a ServerSocket instance.

It doesn't operate according to the expectation though I am trying use port
4000, now.

On the another PC, execute a command "telnet emulator PC's machine 4000".
But, it is not possible to connect to the emulator PC.

thanks

--~--~---------~--~----~------------~-------~--~----~



Question about ServerSocket

by linker lv » Wed, 19 Nov 2008 13:25:52 GMT


 you must use "telnet 10.0.2.2" if you want to telnet to emulator.
10.0.2.2: emulator's IP.

2008/11/19 riverwide <[EMAIL PROTECTED]>


--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Pulseaudio on android

Hi,
    I want to play two audio streams simultaneously on Android. And for this
I thinking to port Pulseaudio on Android. Please help me is it possible to
port pulseaudio on Android.


Thanks & Regards
Rakesh

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

2. Android Shrink Animation

Hi,

Does anyone know of a good tutorial for doing some simple layout
animation effects? I basically want to shrink a set of controls when a
button is clicked, and expand another set. Any help would be
appreciated. Thanks.

-- 

3. Activity/ Layout on top of the InCallScreen

4. resource IDs and sharedUserId

5. EditText wrapped in ScrollView

6. Activity on top of the InCallScreen

7. bikin hotspot pake wifi lapto