Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
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 1628 times)
0 Members and 1 Guest are viewing this topic.
Offline antoinelechacal

Junior Member





« Posted 2005-10-09 18: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?

Thanks!

My name is nobody
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 756
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #1 - Posted 2005-10-10 01: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 Member




Flame On!


« Reply #2 - Posted 2005-10-13 19: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.

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

Junior Member





« Reply #3 - Posted 2005-10-31 20: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 09: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 mygameserver.com 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 Member





« Reply #5 - Posted 2005-11-02 13: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  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (25 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (43 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
java-gaming.org 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‑gaming.org
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!