• Post Reply Bookmark Topic Watch Topic
  • New Topic

Networking with theads  RSS feed

 
rob armstrong
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Making a netorking type game. I have a chat program that will works fine.(I can handle that part). Questin is a want to send back and forth x and y postions for specific objects that will display on both the server and the client. Would i extend the Socket class or what? I know how to send scanner objects and convert them to strings to convert them to labels to display them on a gui screen but i am not sure how to send x, y pos stuff. I know i could send them the same way and convet them to varialbes to be used in a loop or someting. Anyway any ideas?
thanks
roba
 
Peter Petrov
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

If you have a chat program why is it so hard for you to send those
X and Y? In your chat program you are probably sending strings in one
way or another. Well, then ... Where is the difference between that
and sending your X and Y for example? Maybe your problem is that you
need some sort of callback methods? I mean maybe you want that not
only your client can call the server but you also want the server
to be able to call the client in some situations. Is that so?

Regards.
 
rob armstrong
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I may need that ya. I figured I could make it that way but I wondered if converting everthing to Strings is the way to do it (most effiecent). But I suppose it would work fine. Was just nervous about writing the code and find out that it is not fast enough. But trial and error is a virtue i guess. I plan to have 1000 objects or so on the screen and sometimes 200 of them may move and a given time so i need to send all of the x, y postions of all the 200 at once or close to at once.
Thanks for your advise.
roba
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you can send a string, you can send an int. Or perhaps its not your chat program and your modifying it? I wouldn't send the ints as strings. If thats what your thinking you need to get a bit deeper into the code so you can send the ints as ints.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!