Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

sending an array through a socket

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I try to do a pong game to play in network. Two applications one client an another server. The server commands the ball and send the coordinates of the ball and the position of the racquet to the client in an array by mean of an array. And the problem is that the array values don't refresh, the values are the same always. I use the method writeObject(int[] m) and readObject()

I try to use ArrayList instead of an array, and Integer, but does't change the result. Aswell try to use a new class Message with variable members the coordinates of the ball and racquet, but is the same problem
 
Saloon Keeper
Posts: 6258
58
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We would need to see some code. How do you know that the array values aren't changing?
 
Marshal
Posts: 65851
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . . and welcome to the Ranch
 
Sheriff
Posts: 6270
168
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Pedro Sosa!

As to sharing code, you have several options.  One is to create an SSCCE (that's a link), but this may be difficult with a Client/Server application.  The other to share a GitHub url, but this may provide too much information.

So, as a third option, try to share just the class that you think is causing the problem, or even a snippet of the class, but make sure there is enough code to understand what is going on.
 
Pedro Sosa
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code is available in:

https://github.com/psosmol/javaArraySocket

Thanks
 
Knute Snortum
Sheriff
Posts: 6270
168
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You only uploaded a zip file, not the actual Java source files.  Most people aren't going to take the time to unzip the files.  Try uploading the sources to GitHub instead.
 
No, tomorrow we rule the world! With this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!