From: Joerg 'H. P. <pl...@ha...> - 2004-12-09 17:15:19
|
Ok, stupid me, was a bit tired yesterday .... Whats missing on the client is a frequent update of the station. This can be accomplished in several ways: 1.) add station.startReceive(); just before enterLoop(). This starts a seperate thread waiting for new tickets from the net. This works totally asynchronously then. 2.) in doLoop(), add station.handleIncoming( true ); to the loop. This blocks your loop until a ticket is received and handled. You could also use station.handleIncoming( false );, which is non-blocking. In this case you should throttle that loop with a sleep() or something! This has the advantage that network handling is synchronized with your loop. BTW, the additional flush() in the server in fact isn't needed. Now it works, - J ----- Original Message ----- From: "todd runstein" <tod...@ya...> To: <drt...@li...> Sent: Monday, December 06, 2004 8:16 PM Subject: [Drts-devel] Help with NetStation broadcast method > I'm trying to understand how to use the Headquarter > objects and have written a small sample application to > test my understanding. Obviously, my understanding is > lacking. > > I've written a server (NetStation constructed with a > port) and a client (NetStation without a port). I > create a line between the client and the server and > then pass BusTickets over the line. When a client > creates a line to the server, or begins to close, I > have the client send a ticket with a specific identity > (a NamedIdentity of "simple.connect"). The server > sees this message and is able to respond, so I'm at > least on the right track. > > The client starts up a GUI that includes a button. > The action of the button causes a ticket to be created > and sent to the server. This ticket has a different > identity type (a NamedIdentity of "simple.move"), and > is also seen by the server. > > The intent is for the BusTicketListener at the server > simply to send the ticket back out to it's lines using > the broadcast and flush methods. I have a > BusTicketListener on the client that is supposed to > pick up messages of identity simple.move. The client > is not receiving these tickets. > > I've called the add method on the clients NetStation, > passing the NamedIdentity and my BusTicketListener > object. What else do I need to do to get the > broadcast message to be sent and recieved at the > client? > > I have attached the sample app that I'm using. If > anyone has any ideas on what I've done wrong, I'd > appreciate some help. > > Thanks > > Todd > > ===== > The only "dumb question" is the one you were too afraid to ask. > ________________________________________ > Check out RouteRuler - Free software for runners, cyclists, walkers, etc. > http://routeruler.sourceforge.net > ________________________________________ > Get a handle on your data with "pocOLAP", the "little" OLAP project > http://pocolap.sourceforge.net > ________________________________________ > > > > __________________________________ > Do you Yahoo!? > Read only the mail you want - Yahoo! Mail SpamGuard. > http://promotions.yahoo.com/new_mail |