Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (757)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (844)
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  
  Blocking ObjectInputStream without any exception :-(  (Read 2892 times)
0 Members and 1 Guest are viewing this topic.
Offline antoinelechacal

Junior Devvie

« Posted 2005-10-09 16:41:10 »

Hi y'all.

In my run() method (from a class that implements runnable  Wink), I use this:
"ois=new ObjectInputStream(so.getInputStream())"
where so is a socket Wink

The problem is: when executing this code, the applications blocks without throwing any exception, and I don't know how to solve that problem!
The same code with ObjectOutputStream works,  Undecided

Any idea?


My name is nobody
Offline Riven

« JGO Overlord »

Medals: 1340
Projects: 4
Exp: 16 years

Hand over your head.

« Reply #1 - Posted 2005-10-09 23:52:28 »

You have to flush the outputstream, to force the bytes to be sent (not buffered). Then the inputstream will receive the bytes without further blocking.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline cknoll

Junior Devvie

Flame On!

« Reply #2 - Posted 2005-10-13 17:44:30 »

Also take care where you are try {} catch{} your exception.  If you are doing it in the thread that CREATES the spun-off thread (the one that actually runs run() ) then you'll never catch the exception. Exceptions are bubbled up in the same context of the thread that is running it.  So, you could be getting an exception, just never seeing it.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline antoinelechacal

Junior Devvie

« Reply #3 - Posted 2005-10-31 19:16:56 »

Thanks for your help guys, my network is OK at a local level, I'm now facing an other problem...

I want to extend my network to the internet, how does it work? what should I use?

Any advice would be much appreciated!  Cheesy

Thanks a lot!

My name is nobody
Offline Eli Delventhal

JGO Kernel

Medals: 42
Projects: 11
Exp: 10 years

Game Engineer

« Reply #4 - Posted 2005-11-02 08:40:29 »

You can just use the same old thing for internet networking, just connect to ips or domains instead. If you wanted to make an app that could automatically link people together (like GameSpy or something), you would need to have a server running constantly at some address (let's just say for now) that your game automatically connects to when looking for internet games. The app running on this server saves a person's ip automatically when they log in and similarly gets rid of it when logging off, then displays a list of the ips.

Perhaps add in the ability to double click an ip to form a connection with it and you're good to go. Your server app can then pass this ip on to the actual game, which you plug in to your Socket, just like on a local level.

If you already understand sockets on a local level, it's really very simple to go over the whole internet. And you don't even need to make a server of any kind if you don't want, you could just have people figure out ips on their own.

Good luck, I hope that made sense to you.

See my work:
OTC Software
Offline antoinelechacal

Junior Devvie

« Reply #5 - Posted 2005-11-02 12:12:14 »

Don't worry, it makes sense!

Thanks for advising me, my network seems to work on the internet.

My name is nobody
Pages: [1]
  ignore  |  Print  

EgonOlsen (42 views)
2018-06-10 19:43:48

EgonOlsen (22 views)
2018-06-10 19:43:44

EgonOlsen (43 views)
2018-06-10 19:43:20

DesertCoockie (197 views)
2018-05-13 18:23:11

nelsongames (124 views)
2018-04-24 18:15:36

nelsongames (123 views)
2018-04-24 18:14:32

ivj94 (864 views)
2018-03-24 14:47:39

ivj94 (125 views)
2018-03-24 14:46:31

ivj94 (768 views)
2018-03-24 14:43:53

Solater (140 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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!