Threads for networking and DatagramSocket

by Lex » Wed, 29 Jul 2009 18:42:27 GMT


Sponsored Links
 My Android app is exchanging traffic messages via UDP with a server -
binary messages of up to 60 Bytes. The server I'm using (external,
don't have access to code nor can I convince the developer to change
stuff :( ) is identifying the clients solely through sockets (no other
type of client ID whatsoever), so I need to use the same socket for
receiving and sending. My initial plan was to use separate Threads for
receiving and sending data. The network load depends on the traffic
situation - sometimes there might be a lot of messages coming in,
sometimes only a few. The client also needs to send periodic keep-
alive messages, which are simple, 10 character strings. Now the
problem is that Java's DatagramSocket.receive method() is synchronized
and also blocking as long as there is data to receive, so my sending
thread cannot use the socket for sending anything, which results in
the server kicking off the client because there's no response coming.

My question is, how bad (or not bad) do you think will rejecting the
threads and doing all the networking as described above in the UI
thread be? Of course, if you also have suggestions on how to overcome
the issue, it will be greatly appreciated!

Cordialement

Lex
--~--~---------~--~----~------------~-------~--~----~



Threads for networking and DatagramSocket

by Roman » Wed, 29 Jul 2009 23:06:49 GMT


 I recommend to keep your data communication separate from the UI. The
UI should be responsive as possible and you don't want to have any
blocking on this level. In general data connectivity is not
predictable and in worse case you are waiting for a response from the
network and blocking your whole UI. For example how would you
interrupt your data communication from UI perspective when you handle
data communication within the UI and your UI is blocked?

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
T  Mobile stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.



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


Sponsored Links


Threads for networking and DatagramSocket

by Lex » Thu, 30 Jul 2009 21:47:09 GMT


 Thank You for your advice, Roman. There's a detailed post about my
issue on the Java Sun Forum:
 http://forums.sun.com/thread.jspa?messageID=10779608& ;#10779608

Lex




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



Other Threads

1. Another slider from android ?

Keren bentuknya kaya miley...

sent from Milestone...




Tertarik karena tipis
Laennya sih biasa aja XD



@engadget: Inbrics M1 is the thinnest Android slider we've seen, probably
everything we ever wanted http://bit.ly/7qdHma

Twitter Link: http://twitter.com/engadget/statuses/7579352277

Sent via SocialScope Lite (www.socialscope.net)


Regards
Dzikki
--
=========================
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group:

Click  

2. Fw: WTI: Inbrics M1 is the thinnest Android slider we've seen, probably everything we ever wanted

Miley looks like..i like it..

sent from Milestone...




Ingpo dari sebelah

_____
have you googled anything today?

-----Original Message-----
From: "Ju Ming" <jum...@gmail.com>
Date: Sun, 10 Jan 2010 05:59:13
To: Milis<gadtor...@yahoogroups.com>
Subject: [gadtorade] WTI: Inbrics M1 is the thinnest Android slider we've
seen, probably everything we ever wanted

Yang mau beli Nexus-1, mungkin, bisa pertimbangkan ini....


We don't know what everybody else in the phone business has been doing
lately, but Inbrics has just unveiled what looks to be the near-ultimate
Android phone. The Inbrics M1 is a slider handset with a (great) 3.7-inch
WVGA AMOLED display, 3 megapixel camera, front-facing VGA camera, 16GB of
built-in storage, microSD slot and all the other usual t{*filter*}s, but what's
particularly stunning is that the phone is not only half an inch thick, but
it has a full QWERTY keyboard that's surprisingly clicky and typable. The
phone is running Android 1.5 right now, but it should be up to Android 2.0
by the time it hits the market in March. The biggest concern is the 800MHz
Samsung processor, the same chip that's in the Samsung Moment, but the
interface (as demonstrated in the video after the break) is smooth as
butter, and they demo'd it playing back 720p video just fine.

Inbrics actually has a lot of custom UI and software running on top of
Android, but the most interesting part is what they're doing with video
calling and beaming media from handset to videophone to TV to laptop over
DLNA or through an access point device that plugs into the TV over HDMI.
Inbrics also has a Cover Flow-style media browser that isn't super deep in
functionality, but still puts the stock Android stuff to shame, and some
rather {*filter*} custom widgets.

The plan is apparently to get a carrier to bite and rebrand this phone in
the US, so price and availability are still pretty hard to pin down, but if
this phone can hit the market soon it sure could give the rest of the QWERTY
Android sliders out there some body image issues.

Gallery: Inbrics M1 hands-on

Continue reading Inbrics M1 is the thinnest Android slider we've seen,
probably everything we ever wanted

Inbrics M1 is the thinnest Android slider we've seen, probably everything we
ever wanted originally appeared on Engadget on Sat, 09 Jan 2010 21:40:00
EST. Please see our terms for use of feeds.
Permalink   |   | Email this | Comments

 http://www.***.com/ 

--
This article was sent using my Viigo.
For a free download, go to  http://www.***.com/ 


--
Sincerely,

u Ming
------------------------------------

Ho ho ho....
Merry Christmas to you guys.. Damai di bumi Damai di hati.
  http://www.***.com/ ;feature=youtube_gdata

-------
Keep Trading, Keep Smiling
www.gadtorade.com
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://www.***.com/ 

<*> Your email settings:
   Individual Email | Traditional

<*> To change settings online go to:
    http://www.***.com/ 
   (Yahoo! ID required)

<*> To change settings via email:
   gadtorade-dig...@yahoogroups.com
   gadtorade-fullfeatu...@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
   gadtorade-unsubscr...@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://www.***.com/ 


--
=========================
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group:

Click   http://www.***.com/ 
         Choice Apply for Group Membership

or

 Please visit the following page:
  http://www.***.com/ 

To send a message to the owner, visit the following page:

  http://www.***.com/ ;hl=en-GB    or

   id.andr...@gmail.com

For more options, visit this group at
 http://www.***.com/ 

To unsubscribe from this group, send email to
id-android+unsubscr...@googlegroups.com<id-android%2bunsubscr...@googlegroups.com>

Indonesian Android Community on Facebook

 http://www.***.com/ 

=========================

3. alertdialog, under what circumstances will invoking .show directly cause problems?

4. RockOn - Music Player..

5. "Something wrong here" error message

6. no package identifier when getting value for resource

7. Internal module kernel