Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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  
  Net Dash (WIP)  (Read 4847 times)
0 Members and 1 Guest are viewing this topic.
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Posted 2010-09-23 21:26:00 »

Server up at 98.210.146.214

Hey all,

The last multiplayer game (before this one) that I wrote was somewhere around 2007. Because I love multiplayer games and because I don't want to have such a blaring weakness in my repertoire, I've been brushing up on my skills.

First I made a framework using Sockets that creates new threads for every connection, kills inactive users, and the like. It's very bare bones but theoretically can have anything built on top of it.

Then I made a chat room on top of that framework. Works fine (not going to bother to share it).

Finally, I made a very simple game (about 1.5 weeks on spare time work) and decided to call it Net Dash.

[size=18pt]Net Dash[/size]

I'm unable to get a good screenshot at the moment, but I think that'll give you an idea.


From the applet page:
This is a test for a multiplayer racing-type game. It's the first multiplayer game I've made in many years, so I'm trying to refresh myself. It's incredibly hacky (I was more interested in getting something done than anything else) and is only about a week in the making, but it's still pretty fun.

Basically, you want to get to the far right side of the level before the other player(s). You can do this by moving with the arrow keys. Pressing up or down will boost you in that direction. Pressing space will boost you to the right. Your boosts only recharge while you're standing on the ground. If you boost while near another player, you'll knock them backwards.

Note that I implemented this in a pretty bad way. Pretty much, the server doesn't trust the client at all. The server receives input events, decides what to do with them, and then broadcasts changes back to the clients. This works great in turn-based games or non-twitch games, but in this game (which is twitch) it definitely doesn't work. The problem is that the latency becomes very high for every single action. In the future I will fix this.

Server?
There is no dedicated server of any kind at the moment. Tonight I will try installing it on my video-player-computer and see if that holds up to the pressure. Otherwise I'll run one on my computer tonight for people to try out. In the mean time, you guys can host your own by navigating to:
http://www.otcsw.com/applet/NetDash/server/
Once you've hosted it you can play against yourself.

[EDIT]
I threw up the applet version really fast, it's done stupidly.
- The client constantly requests focus so you can't click anywhere else in that window.
I'd recommend downloading the server JAR and running it directly.

See my work:
OTC Software
Offline DzzD
« Reply #1 - Posted 2010-09-23 21:33:23 »

for 2/3 hours you can try 89.86.173.51 : 15678 Wink

EDIT: heu... how do you type the "." when typing the IP server adress ?

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #2 - Posted 2010-09-23 21:45:08 »

for 2/3 hours you can try 89.86.173.51 : 15678 Wink

EDIT: heu... how do you type the "." when typing the IP server adress ?
Ha crap I recently broke that. :-)

I'd better fix it. :-D While I'm at it I can make the applets clean up.

EDIT:
Okay I fixed it. I was fixing a different bug and accidentally didn't allow periods. Smiley

EDIT2:
Definitely needs some better feedback from the client when it tries to connect. Seems to be locked up for a very long period of time before it gets to your server, with no errors. I got a timeout when trying to connect to you.

See my work:
OTC Software
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline DzzD
« Reply #3 - Posted 2010-09-23 22:04:35 »

that's working, I try to launch server but it seems to only listen on IP 127.0.0.1 (work for me but dont know if someone can connect)

EDIT: may be the socketserver does not listen on all IP (only on localhost / 127.0.0.1 )?

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #4 - Posted 2010-09-23 23:46:54 »

that's working, I try to launch server but it seems to only listen on IP 127.0.0.1 (work for me but dont know if someone can connect)

EDIT: may be the socketserver does not listen on all IP (only on localhost / 127.0.0.1 )?
I've played across the US with no problems (from California to Chicago). And around the San Francisco Bay Area a few times. It's not there's an easy way to force it to listen on a small range of IPs... you have to do extra work to do that.

See my work:
OTC Software
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #5 - Posted 2010-09-24 04:04:45 »

Server up at 98.210.146.214

See my work:
OTC Software
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 744
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #6 - Posted 2010-09-24 09:48:42 »

I've played across the US with no problems (from California to Chicago). And around the San Francisco Bay Area a few times. It's not there's an easy way to force it to listen on a small range of IPs... you have to do extra work to do that.

If you want to listen to all IPs, bind to 0.0.0.0

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline CyanPrime
« Reply #7 - Posted 2010-09-24 16:50:35 »

The applet seemed to freeze:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
Java Plug-in 1.6.0_21
Using JRE version 1.6.0_21-b07 Java HotSpot(TM) Client VM
User home directory = C:\Users\neeowolf

----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------

security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition value null
security: property package.definition new value com.sun.javaws
security: property package.definition value com.sun.javaws
security: property package.definition new value com.sun.javaws,com.sun.deploy
security: property package.definition value com.sun.javaws,com.sun.deploy
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
security: property package.definition value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@82c01f
basic: Plugin2ClassLoader.addURL parent called for http://www.otcsw.com/applet/NetDash/server/RaceTestServer.jar
network: Cache entry not found [url: http://www.otcsw.com/applet/NetDash/server/RaceTestServer.jar, version: null]
network: Connecting http://www.otcsw.com/applet/NetDash/server/RaceTestServer.jar with proxy=DIRECT
network: Connecting http://www.otcsw.com:80/ with proxy=DIRECT
basic: Loading Java Applet ...
network: Downloading resource: http://www.otcsw.com/applet/NetDash/server/RaceTestServer.jar
   Content-Length: 57,325
    Content-Encoding: null
network: Wrote URL http://www.otcsw.com/applet/NetDash/server/RaceTestServer.jar to File C:\Users\neeowolf\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\13\4133750d-6c86f3aa-temp
network: CleanupThread used 93792 us
security: Blacklist revocation check is enabled
security: Trusted libraries list check is enabled
network: CleanupThread used 2 us
security: Accessing keys and certificate in Mozilla user profile: null
security: Loading Root CA certificates from C:\Program Files (x86)\Java\jre6\lib\security\cacerts
security: Loaded Root CA certificates from C:\Program Files (x86)\Java\jre6\lib\security\cacerts
security: Loading Deployment certificates from C:\Users\neeowolf\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs
security: Loaded Deployment certificates from C:\Users\neeowolf\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Validate the certificate chain using CertPath API
security: Obtain certificate collection in Root CA certificate store
security: Obtain certificate collection in Root CA certificate store
security: Start to check whether root CA is replaced
security: The root CA hasnt been replaced
security: No timestamping info available
security: Found jurisdiction list file
security: No need to checking trusted extension for this certificate
security: The CRL support is disabled
security: The OCSP support is disabled
security: This OCSP End Entity validation is disabled
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
security: Checking if certificate is in Deployment session certificate store
security: User has granted the priviledges to the code for this session only
security: Adding certificate in Deployment session certificate store
security: Added certificate in Deployment session certificate store
security: Saving certificates in Deployment session certificate store
security: Saved certificates in Deployment session certificate store
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Validate the certificate chain using CertPath API
security: Obtain certificate collection in Root CA certificate store
security: Obtain certificate collection in Root CA certificate store
security: Start to check whether root CA is replaced
security: The root CA hasnt been replaced
security: No timestamping info available
security: Found jurisdiction list file
security: No need to checking trusted extension for this certificate
security: The CRL support is disabled
security: The OCSP support is disabled
security: This OCSP End Entity validation is disabled
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
security: Checking if certificate is in Deployment session certificate store
basic: Plugin2ClassLoader.getPermissions CeilingPolicy allPerms
basic: Applet loaded.
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 227012 us, pluginInit dt 4576556 us, TotalTime: 4803568 us
basic: Applet initialized
basic: Loading Java Applet ...
basic: Removed progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@82c01f
basic: Applet made visible
basic: Starting applet
basic: completed perf rollup
basic: Applet started
basic: Told clients applet is started
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #8 - Posted 2010-09-25 03:11:31 »

The applet seemed to freeze:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
Java Plug-in 1.6.0_21
Using JRE version 1.6.0_21-b07 Java HotSpot(TM) Client VM
User home directory = C:\Users\neeowolf

----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------

security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition value null
security: property package.definition new value com.sun.javaws
security: property package.definition value com.sun.javaws
security: property package.definition new value com.sun.javaws,com.sun.deploy
security: property package.definition value com.sun.javaws,com.sun.deploy
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.access new value sun.,com.sun.xml.internal.ws.,com.sun.xml.internal.bind.,com.sun.imageio.,com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
security: property package.definition value com.sun.javaws,com.sun.deploy,com.sun.jnlp
security: property package.definition new value com.sun.javaws,com.sun.deploy,com.sun.jnlp,org.mozilla.jss
basic: Added progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@82c01f
basic: Plugin2ClassLoader.addURL parent called for http://www.otcsw.com/applet/NetDash/server/RaceTestServer.jar
network: Cache entry not found [url: http://www.otcsw.com/applet/NetDash/server/RaceTestServer.jar, version: null]
network: Connecting http://www.otcsw.com/applet/NetDash/server/RaceTestServer.jar with proxy=DIRECT
network: Connecting http://www.otcsw.com:80/ with proxy=DIRECT
basic: Loading Java Applet ...
network: Downloading resource: http://www.otcsw.com/applet/NetDash/server/RaceTestServer.jar
   Content-Length: 57,325
    Content-Encoding: null
network: Wrote URL http://www.otcsw.com/applet/NetDash/server/RaceTestServer.jar to File C:\Users\neeowolf\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\13\4133750d-6c86f3aa-temp
network: CleanupThread used 93792 us
security: Blacklist revocation check is enabled
security: Trusted libraries list check is enabled
network: CleanupThread used 2 us
security: Accessing keys and certificate in Mozilla user profile: null
security: Loading Root CA certificates from C:\Program Files (x86)\Java\jre6\lib\security\cacerts
security: Loaded Root CA certificates from C:\Program Files (x86)\Java\jre6\lib\security\cacerts
security: Loading Deployment certificates from C:\Users\neeowolf\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs
security: Loaded Deployment certificates from C:\Users\neeowolf\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Validate the certificate chain using CertPath API
security: Obtain certificate collection in Root CA certificate store
security: Obtain certificate collection in Root CA certificate store
security: Start to check whether root CA is replaced
security: The root CA hasnt been replaced
security: No timestamping info available
security: Found jurisdiction list file
security: No need to checking trusted extension for this certificate
security: The CRL support is disabled
security: The OCSP support is disabled
security: This OCSP End Entity validation is disabled
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
security: Checking if certificate is in Deployment session certificate store
security: User has granted the priviledges to the code for this session only
security: Adding certificate in Deployment session certificate store
security: Added certificate in Deployment session certificate store
security: Saving certificates in Deployment session certificate store
security: Saved certificates in Deployment session certificate store
security: Loading certificates from Deployment session certificate store
security: Loaded certificates from Deployment session certificate store
security: Validate the certificate chain using CertPath API
security: Obtain certificate collection in Root CA certificate store
security: Obtain certificate collection in Root CA certificate store
security: Start to check whether root CA is replaced
security: The root CA hasnt been replaced
security: No timestamping info available
security: Found jurisdiction list file
security: No need to checking trusted extension for this certificate
security: The CRL support is disabled
security: The OCSP support is disabled
security: This OCSP End Entity validation is disabled
security: Checking if certificate is in Deployment denied certificate store
security: Checking if certificate is in Deployment permanent certificate store
security: Checking if certificate is in Deployment session certificate store
basic: Plugin2ClassLoader.getPermissions CeilingPolicy allPerms
basic: Applet loaded.
basic: Applet resized and added to parent container
basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 227012 us, pluginInit dt 4576556 us, TotalTime: 4803568 us
basic: Applet initialized
basic: Loading Java Applet ...
basic: Removed progress listener: sun.plugin.util.GrayBoxPainter$GrayBoxProgressListener@82c01f
basic: Applet made visible
basic: Starting applet
basic: completed perf rollup
basic: Applet started
basic: Told clients applet is started

Yeah, I think it's the initial level data being sent over - it sends a pretty bit int array all at once. I haven't tested this thoroughly enough at long distances to really tell why yet. And if you look at your log you can see that there is no actual crash, it's just "locked up." But in reality if you leave it for a while it should connect or time out. Could be that I'm running it from a very slow machine - its just a spare Mac Mini I use for watching videos.

See my work:
OTC Software
Offline Momoko_Fan

Junior Member


Medals: 2



« Reply #9 - Posted 2010-09-25 05:48:25 »

Uh ...

Connecting to 98.210.146.214 on port 15678
Couldn't connect to server.
java.net.UnknownHostException: 98.210.146.214

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

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #10 - Posted 2010-09-25 07:50:10 »

Uh ...

Connecting to 98.210.146.214 on port 15678
Couldn't connect to server.
java.net.UnknownHostException: 98.210.146.214


Interesting... according to the limited logs it has seen a few people connect and doesn't have any errors.

Oh well. I'll look into it again later.

See my work:
OTC Software
Offline markus.borbely

Junior Member





« Reply #11 - Posted 2010-09-25 11:08:09 »

I got this two times:

Quote
Connecting to 98.210.146.214 on port 15678
Couldn't connect to server.
java.net.ConnectException: Connection timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at com.otcsw.networking.GameClient.connect(GameClient.java:41)
    at com.otcsw.networking.game.client.GameController.keyReleased(GameController.java:51)
    at java.awt.Component.processKeyEvent(Unknown Source)
    at javax.swing.JComponent.processKeyEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
    at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
    at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
    at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
    at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
Success connecting.

Don't do blocking things in that thread. Everything (including the console) froze. Smiley

After I got the Success connecting, I got back to the "not connected" screen.
Also, I couldn't type in my message here untill I killed the tab with the applet and refreshed.
Running Win xp and firefox.
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #12 - Posted 2010-09-26 03:37:22 »

I got this two times:

Don't do blocking things in that thread. Everything (including the console) froze. Smiley

After I got the Success connecting, I got back to the "not connected" screen.
Also, I couldn't type in my message here untill I killed the tab with the applet and refreshed.
Running Win xp and firefox.
Weird, I'll look into the timeout problems too. Yeah, I think I'm connecting from the main thread, I should do that from another one... thanks for testing it so far, y'all.

See my work:
OTC Software
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 744
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #13 - Posted 2010-09-26 18:20:06 »

You're probably better of with this utility method:

1  
2  
3  
4  
5  
6  
7  
8  
public static Socket connect(String host, int port, int timeout) throws IOException
{
   if(SwingUtilities.isEventDispatchThread())
      throw new IllegalStateException("networking from EDT");
   Socket socket = new Socket();
   socket.connect(new InetSocketAddress(host, port), timeout);
   return socket;
}

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

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #14 - Posted 2010-09-26 19:34:50 »

You're probably better of with this utility method:

1  
2  
3  
4  
5  
6  
7  
8  
public static Socket connect(String host, int port, int timeout) throws IOException
{
   if(SwingUtilities.isEventDispatchThread())
      throw new IllegalStateException("networking from EDT");
   Socket socket = new Socket();
   socket.connect(new InetSocketAddress(host, port), timeout);
   return socket;
}

Ah, great. That's very helpful. Yeah come to think of it I think indeed the EDT is the one making the connection, which is definitely a silly idea.

See my work:
OTC Software
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.

Riven (4 views)
2014-07-29 12:53:52

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

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

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

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

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

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

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (51 views)
2014-07-17 23:47:54
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

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!