Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing a String[][] using sockets  RSS feed

 
Leslie Chaim
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am looking for some code snippet to pass a two dimensional String array from a client program to a server program.
Verbose examples are greatly appreciated
Thanks.
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe I'm forgetting something, but why would this be different from passing any other object?
 
Leslie Chaim
Ranch Hand
Posts: 336
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed I did not mean String per se,
I want to know whether its possible with two dimensional objects. But, based on what you are saying may I conclude that when I say writeObject(data) in my client, and

in my server that I am done?
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put another bracket pair in that type identifier, and I can't think of why it shouldn't work. I'll try it here myself and see if something strange happens.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arrays are intrinsically Serializable, so if the contents are Serializable you should be able to just send it with an ObjectOutputStream.
Bill
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!