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. Long Term Contract Position_ Android Developer _CA

Hello Friends,

Hope you are doing great

We are looking for energetic, smart, self-starting J2ME/Android
engineers to join the team and help make a daily impact on our product
and the company's overall growth. I wanted to contact you to see if
you are available and comfortable with below mentioned opportunity. If
so, please send me an updated copy of your resume and the best way for
me to contact.

If you know anyone, who is available and comfortable, Feel free to
pass my contact details to them. Thanks in advance and hope to hear
from you soon!

Location: CA
Duration: 6-12 Months+
Telecommute Option is not available

Responsibilities
Port existing product from the iPhone to Android, Blackberry, and
other Java based phone platforms
Identify new and unique features which can be added to new platforms
to make the product standout from the crowd
Become the in-house expert on building and deploying applications to
Android and J2ME store fronts for the different mobile providers


Required Skills
Expertise with Mobile Java Programming. Experience with J2ME is a
must; hands on experience with Android development and deployment is a
distinct advantage
Programming networked applications, preferably using HTTP. Additional
experience with TCP/IP sockets in mobile is a plus
Experience with deploying applications on multiple carriers, for
multiple handsets.
Ability to write good, clean, reusable code
Ability to create solid, reusable UI to match with the GOGII look and
feel


Desired Skills
Any server side programming experience (J2EE, MySQL, Hibernate, etc) a
huge plus.
iPhone development experience not required, but helpful.
Experience with Blackberry development


Experience
5+ years developing software
Experience working with small teams, especially in a start-up
environment




Thanks & Regards
Navneet Chalana
Sr. Account Manager
631-685-1134 x 260 | navn...@okayainfo.com |
Okaya Inc. 99 Mark Tree Rd, Suite 304 Centereach, NY 11720 |
URL: http://www.okayainfo.com - Fax: 631-389-2446 |

2. Announcement: [New project] Build and run only Dalvik



Start by modifying build/core/combo/linux-arm.mk to point to your toolchain.
However, 3.4.1 seems to be a bit old.

Avtar









>

3. https with user+password

4. Strange issue with webkit

5. Public calendar API for android

6. Reminder IRC office hours today 5:00- 6:00 PST

7. Difference between ImageView.setImageBitmap() and RemoteView.setImageViewBitmap() ????