|
-
Mar 7th, 2008, 07:56 AM
#1
Thread Starter
New Member
Is it possible to send an array through a socket?
Hi,
We're students from Holland (18 years old) and we're trying to make a chat-program. Ofcourse a couple of problems have passed our way.
Our server and clients are connected via sockets, and in the client's interface we wanted a list with the names of the connected users. When the clients connect, their name is sent to the server and stored in an array. After that, this array (with all the names of the clients connected) should be sent to the client, who puts this array in a list.
Then my question: Is it possible to send this array through a socket to a client so this client can work with it? Is this the easiest way or should we look for an other way to do this?
Kind regards,
Marten & Niek
-
Mar 7th, 2008, 03:53 PM
#2
Re: Is it possible to send an array through a socket?
Is it possible to send this array through a socket to a client so this client can work with it?
Yes
Is this the easiest way or should we look for an other way to do this?
Well, you are storing users in an array, what happens when the number of online users increases! have you thought about that
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Mar 9th, 2008, 03:29 PM
#3
Thread Starter
New Member
Re: Is it possible to send an array through a socket?
How is this possible?
And we were thinking of every now and then the clients update the list... Or is there a more common way to do this?
-
Mar 9th, 2008, 05:59 PM
#4
Re: Is it possible to send an array through a socket?
I have no idea if there is a more common way. But I know that you can use Socket.getOutputStream() to transfer data from client to server and the other way
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Mar 11th, 2008, 05:12 AM
#5
Thread Starter
New Member
Re: Is it possible to send an array through a socket?
Ok, and do we have to transfer each value of the array (e.g. array[0], array[1], etc.), or is it possible to send the whole array at once?
-
Mar 11th, 2008, 05:33 AM
#6
Re: Is it possible to send an array through a socket?
I'm not sure if it's possible, you can always try.
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Mar 12th, 2008, 11:49 AM
#7
Frenzied Member
Re: Is it possible to send an array through a socket?
 Originally Posted by Niekfct
Ok, and do we have to transfer each value of the array (e.g. array[0], array[1], etc.), or is it possible to send the whole array at once?
Have you considered using ObjectInputStream & ObjectOutputStream?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|