I think you might look at the Java NIO libraries. This is true async.
comms. in Java, and is documented in the Android documentation (http://
developer.android.com/reference/java/nio/package-summary.html). [I
have never used it under Android]

Please be aware that in my experience NIO is not the simplest of APIs,
and you'll need to read up on it.

Ian Hunter

On Jul 14, 5:57 am, Victor Lin <[email protected]> wrote:
> Hi,
>
> I am developing a program that needs async socket. I am new to Android
> and Java. As I can see in the document, to write network program, I
> got Socket and SocketChannel, but it seems they are all sync socket,
> it means, I need an extra thread to call blocking read, write... and
> etc. Here comes the problem, my program is a chat room, the
> communicate is not linear, I have no idea when the server will send a
> message to me, if I read in that thread to wait message from server,
> but the user want to send message to server, the reading function
> blocked forever, if there is no incoming data, then the pending
> outgoing message will not be sent. That's why I need async socket. So
> my question is: How to write async socket under Android environment?
>
> Thanks.
> Victor Lin.

--~--~---------~--~----~------------~-------~--~----~
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