Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (623)
Games in Android Showcase (176)
games submitted by our members
Games in WIP (676)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  NullPointerException in ChannelImpl.unicastData  (Read 1956 times)
0 Members and 1 Guest are viewing this topic.
Offline akoller

Junior Newbie

« Posted 2006-06-06 12:03:15 »

Hi, I think that Project Darkstar is an awesome tool, but I'm having a little problem with the network communication.

Sometimes when I call SimTask.sendData to send data from the server to the client, I get an exception of the following form:

WARNUNG: Exception on task execution:
  target: org.akoller.sgs.textadv.Boot
  method: userJoined
  declared on:

The data the server wanted to send never arrives at the client in such a case. The exception occurs unpredictably -- sometimes the data sending goes through, but rarely enough to make my game unplayable.

This already happened with the original SwordWorld system from the tutorial (after I had changed makeReference to lookupReferenceFor to get it to run). One thing that seemed to eliminate these exceptions in SwordWorld was to call openChannel("GAMECHANNEL") to get a new ChannelID for each call to sendData. But (a) the documentation says the lifetime of a ChannelID is from start to finish of a run of the server, so I shouldn't need to acquire new ChannelIDs for each sendData call, and (b) it doesn't really help after all -- in my little experimental text adventure that I've been developing, which doesn't do much that SwordWorld doesn't at this point, the problem comes back even then.

The problem comes from calls to sendData, not from userJoined as the example above seems to suggest; it just occurs there because I send a welcome message to the user when they join the game.

Can you give me any advice on how to deal with this problem?
Offline Jeff

JGO Coder

Got any cats?

« Reply #1 - Posted 2006-06-07 20:44:59 »


My guess is that you are trying to send the data to the user befoer the user is joined.  Are you waiting for userJoinedChannel callback?  If so then thre may be a timign issue I need to look into.  If its timing then inserting s amll sleep before the send aught to fix it BUT thats a hack so Id like to make sure it really is a bug first...

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!
Offline akoller

Junior Newbie

« Reply #2 - Posted 2006-06-11 08:39:26 »

I just figured out what my problem probably was. I tried to send data to a null UserID. Sending to simTask.getUserID() instead seems to have fixed the issue. I still don't know why I had problems with the SwordWorld demo server, but perhaps it was something similarly trivial too.

 Embarrassed  Embarrassed  Embarrassed

I'm sorry for wasting your time with such a silly mistake. Now that I've figured out how to use a debugger on the SGS, I'm going to hunt my own bugs more thoroughly next time.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder

Got any cats?

« Reply #3 - Posted 2006-06-12 21:28:53 »

Not a problem, its how we all learn.  Cool

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

KaiHH (12 views)
2015-10-06 20:22:20

KaiHH (11 views)
2015-10-06 19:41:59

BurntPizza (18 views)
2015-10-06 19:04:48

basil_ (44 views)
2015-09-30 17:04:40

shadowstryker (22 views)
2015-09-29 15:55:06

TheSpaceHedgehog (28 views)
2015-09-29 01:58:48

GamerC4 (54 views)
2015-09-24 21:10:38

GamerC4 (71 views)
2015-09-24 21:09:48

htuy (28 views)
2015-09-24 04:57:24

htuy (38 views)
2015-09-24 04:56:35
Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!