Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #16781 > unrolled thread

LAN strategy (Android)

Started by"Dirk Bruere at NeoPax" <dirk.bruere.at.neopax@1:261/38.remove-dpk-this>
First post2012-07-31 18:02 +0000
Last post2012-07-31 18:02 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  LAN strategy (Android) "Dirk Bruere at NeoPax" <dirk.bruere.at.neopax@1:261/38.remove-dpk-this> - 2012-07-31 18:02 +0000
    Re: LAN strategy (Android) "Roedy Green" <roedy.green@1:261/38.remove-dpk-this> - 2012-07-31 18:02 +0000

#16781 — LAN strategy (Android)

From"Dirk Bruere at NeoPax" <dirk.bruere.at.neopax@1:261/38.remove-dpk-this>
Date2012-07-31 18:02 +0000
SubjectLAN strategy (Android)
Message-ID<50181D63.55749.calajapr@time.synchro.net>
From: Dirk Bruere at NeoPax <dirk.bruere@gmail.com>

What's the best way to do this?

I have to read from a LAN using UDP. I open a socket by doing a name lookup 
(the name of a PC I want to connect to) and port number as the app starts.

In a thread I loop around reading the socket for messages and act on them.

The problem is what do I do if I cannot access the LAN on startup and so miss 
getting the name/address? As far as I can see the app sits there doing nothing 
even if the LAN becomes available.

Alternatively, do I put the name/address lookup in the thread loop, and if so, 
how?


--
Dirk

Full Spectrum Praxis : ZERO STATE : http://zerostate.net

--- BBBS/Li6 v4.10 Dada-1
 * Origin: Prism bbs (1:261/38)
--- Synchronet 3.16a-Win32 NewsLink 1.98
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#16794

From"Roedy Green" <roedy.green@1:261/38.remove-dpk-this>
Date2012-07-31 18:02 +0000
Message-ID<50181D66.55762.calajapr@time.synchro.net>
In reply to#16781
  To: Dirk Bruere at NeoPax
From: Roedy Green <see_website@mindprod.com.invalid>

On Tue, 31 Jul 2012 00:02:25 +0100, Dirk Bruere at NeoPax
<dirk.bruere@gmail.com> wrote, quoted or indirectly quoted someone who
said :

>What's the best way to do this?

get the book with the three trains on the cover. See 
http://mindprod.com/jgloss/thread.html

use
import java.util.concurrent.BlockingQueue; import 
java.util.concurrent.ConcurrentHashMap; import 
java.util.concurrent.LinkedBlockingQueue; import 
java.util.concurrent.Semaphore; import java.util.concurrent.ThreadPoolExecutor;
--
Roedy Green Canadian Mind Products
http://mindprod.com
The greatest shortcoming of the human race is our inability to understand the 
exponential function.
 ~ Dr. Albert A. Bartlett (born: 1923-03-21 age: 89)
http://www.youtube.com/watch?v=F-QA2rkpBSY

--- BBBS/Li6 v4.10 Dada-1
 * Origin: Prism bbs (1:261/38)
--- Synchronet 3.16a-Win32 NewsLink 1.98
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web