FlagRushNetworking

There's a, not a error, but a incorrect way of get the IPAddress in the InetAddress class. It's funny, I've already fixed this problem in another net project…



You have to put your real IP, when you use the getlocalhost It uses the loopback (127.0.0.1) Address. When I configures by hands .



InetSocketAddress clientReliable = new InetSocketAddress(InetAddress.getByName("192.168.0.102"), 0);



And I played with my friend in other side of our city :stuck_out_tongue: Thankyou very much for the demo :slight_smile:



In that occasion I getted a list of IP and ignored the loopback one. What do you think about add this soluction?

Have anyone another Idea?



Thanks

This is true, but the reason I can't put that into the demo is because I don't know the user's outward facing IP address. :slight_smile:



How do you suggest getting a list of IP addresses for the machine?

Well, now that I've posed the question I went out and answered it myself. :slight_smile:



I'm not sure if this will work on Linux, but on Windows doing:


InetAddress[] addresses = InetAddress.getAllByName("localhost");



Then simply skip over 127.0.0.1 and you've got a non-loopback address.

That is exactly what I did in that time… in a Linux OS. :slight_smile:



Now another problem hehe… I don't know if it's possible, I never done it…



I have a router, that authenticate in my adsl modem, so I have a internal IP address, and my real IP is on router. I can't receive client connection on my FR TestServer :(. Maybe the router has to redirect the request on especfic PORT to my server:PORT. Or how could be done?



That's a newbie question but…

Thanks

Most routers give you the ability to forward externally facing ports (your internet IP address) to internal IP addresses on the same or different ports.  This is done using NAT (Network Address Translation) that keeps both your inside application (that sees that local machine's intranet IP address) from having to know about the external IP address, and the external application from having to know about your machine's internal IP application.

hey ya … i try to run flagrush sample …  n have encounterd a problem … i run the server n client … but on the client side, i can only see the server bike floating in the air … it's not suppose to be like this i guess … haha do you know what's the problem? besides, any tutorial for this … i wish to know how u do the sycn part such as what are the data being sent to and received from one another … hmmm … im getting "received and sent message : Noop" … what does it mean? haha really a noop here, need help! Please … :slight_smile:

Do you get any errors on either console?

nope … din see any so far … i can see the other bike moving… just that its moving in the air instead of on terrain … n the flag keeps changing position … it suddenly disappeard then appear at another place … is that what you intented to do ??? hahhaa …urmmm… anything i can do to solve the problem? :slight_smile:

I don't know about the flying bike, but the flags are suppose to randomly change location



This might help you : http://javagn.org/wiki/FlagRushTutorial

So you mean your code is working fine … can you please gimme the link to where you download them? and the latest jgn … by the way, i take all the source of jgn from the trunk, compile myself and put it as a lib … is this the way of doing it? or any other better way (im using netbeans)… there is no already available jgn.jar somewhere? sorry that im asking such question … :stuck_out_tongue: thankz in advance … :slight_smile:

Oh, I just realized what you were talking about the flying bikes.  The terrain is generated dynamically on each instance so terrain height may be higher or lower on one versus another so one bike on the ground on its terrain may be floating in another. :wink:



You can find links to everything here:



http://javagn.org/

I actually got a problem running the sample … so i use the buildTerrain from another sample(lesson9 i guess). so this ->    MidPointHeightMap heightMap = new MidPointHeightMap(64, 1f); is to generate random data … means both client and server side have different terrain … hmmm …that is the problem rite?



below is the error i got when i run it:



Feb 22, 2008 4:02:21 PM class FlagRush start()

SEVERE: Exception in game loop

java.lang.RuntimeException: java.io.StreamCorruptedException: invalid stream header: 89504E47

        at FlagRush.buildTerrain(FlagRush.java:493)

        at FlagRush.initGame(FlagRush.java:278)

        at com.jme.app.BaseGame.start(Unknown Source)

        at FlagRushTestServer$1.run(FlagRushTestServer.java:28)

Caused by: java.io.StreamCorruptedException: invalid stream header: 89504E47

        at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)

        at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)

        at FlagRush.buildTerrain(FlagRush.java:488)

        … 3 more

Feb 22, 2008 4:02:21 PM com.jme.app.BaseGame start



=========================================================================================



i guess the problem is from this line of code -> ObjectInputStream ois = new ObjectInputStream(getClass().getClassLoader().getResourceAsStream("jmetest/data/images/FlagRush.png"));



any idea please ? :expressionless:

That's something specific to jME, not JGN.  However, I'm not sure why that would happen.  Does that happen every time you run it or just once?

hmmmm … everytime i run … same error … the exception, is it because it cant find the file at the location pointed?

"jmetest/data/images/FlagRush.png" … actually where shud i place this image? i hav tried to change the location … but no luck … thankz … really appreciate your help :slight_smile:

Perhaps you should use the ResourceLocatorTool instead to find the right file in the right place?

Try the lesson code in jME and see if it works…that should be identical to the way jME's flagrush tutorial works already.

Im sorry … I think i have made a stupid mistake … :stuck_out_tongue: … anyway thankz for all the help! one last question … whats the Noop message about ? the one sent and received … anywhere can i get the answer? anyone ? please … :slight_smile:

http://en.wikipedia.org/wiki/NOP



It is sent essentially as a “keep alive” message to let the other side of the connection know the session is still actively being maintained. They are sent periodically when no other traffic is coming across a connection so it doesn’t get timed-out.

Alright! thankz for the answer! :slight_smile:

Unable to find object: 1 on Client



anyone knw what's the cause for this? help pleas … :expressionless: