Jump to content
  • Advertisement

Yar

Sign in to follow this  
  • entries
    208
  • comments
    383
  • views
    65870

Yar!!!

Sign in to follow this  
H_o_p_s

106 views

I was just able to successfully control a JavaTactics that was running on my brother's computer in Oregon! I could chat, and move the camera around! XD

Although I do now have a question: If a small amount of information (a string such as "ae 0231") needs to be sent, is it degrading the time to send the information if I open and close the socket each time? I have a feeling that I should keep the socket open (especially for chat), but the way I have my code set up right now it only opens the port when I send out commands...

So I was thinking... should each JavaTactics instance have an array of connected computers? This way if a new computer connects to any of the ips it auto gets the other player's ip? This way I can keep sockets open too...

But either way, just *so* happy that it worked.

Sample communication:

~>java Requester 198.92.66.53 2004

Connected to 198.92.66.53 in port 2004.
server>Connection successful
client>JTC: Get offline and call me.
server>Completed JTC.
client>SSO: ae 0231
server>Completed SSO.
client>bye
Closed connection to 198.92.66.53 in port 2004.


JTC stands for JavaTacticsChat, and SSO stands for ServerSideOperation (such as moving an actor etc)
Sign in to follow this  


3 Comments


Recommended Comments

Quote:

So I was thinking... should each JavaTactics instance have an array of connected computers? This way if a new computer connects to any of the ips it auto gets the other player's ip? This way I can keep sockets open too...


I personally don't know how you plan on implementing the final game, but assuming you will let several clients play at once, you would certainly want some sort of "lobby" system, so you can deal with player connections at the beginning, and only have to deal with player "drops" in game, and not new connections. And yes, you will want to keep an arraylist or something of the other IPs...you should know them anyway from when you recieve a request to open a socket.

Also, why would you want to close your socket. I have never worked with Java for networking, but if it is anything like C, then closing a socket closes the connection...and reestablishing a tcp connecting (maybe you are using udp?) for every single piece of data sent is...wayyyy overkill. Keep 'er open.

Or maybe I am misunderstanding you.

Share this comment


Link to comment
Nope, thats what I'm doing! I figured when I was writing it that since at max it would send information about every 10 seconds... then I remembered about chat... But I have no experience with network programming, so frankly I didn't know much of what I was doing.

But yeah, plan on keeping the sockets opened... just need to get to writing it... :D

On another note, I've only got a midterm paper to hand in, and one more midterm to take, then I can spend all the time I want on this (at least as long as my mind can handle...)

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!