Hi everybody!
"Desperate SchoolWorkingGuy" wrote:
Altough this question is related to my homework
i want to ask you something simple, yet, very important for me to understand, I have to implement a Message server for Swing-like cell phones, wich everyone in my class will have to design according to their own cellphones, but just the messagin' service part.
The question is about the client and server and the way the client can receive messages "at the same time" its comunicating to the server to send messages too.
Let me make myself clearer...
/*** STARTS
JAVA CODE ***/
/*** ENDS JAVA CODE ***/
This is the Client-Server, i have no problem with the client side, it connects perfectly to the server and registers its telephone ( method registrarCliente ) wich is saved in an ArrayList, and also i can connect and get a list of all the client connected ( method listarClientes ). The problem is when i add a server... if you check my constructor, i have a an instance of the inner class Conexion
conexion = new Conexion( this.socketCliente, this.puertoServidorLocal );
but after starting it, the client can't keep with the registration process ( again the "registrarCliente" method ). All i see in the server is that a client is trying to connect and i believe then the server part of the client ( the above code ) is started due to the threading and because i have a while ( true ) it stays there waiting to receive messages...
So in conclusion, my questions are,
1) Can i have the server and client part in the above code like i'm trying to do it?
2) If it is so, how can i manage both?
3) should i take away the while ( true ) from the client-server side?, but then how do i manage to handle several messages... well, there will be only one client for my client-server code wich is the message server.
If i haven't make myself clear please let me know so.
Many thanks in advance for your help.
P.S. Feel free to ask all you want about translation to English from my Spanish code
[ November 15, 2005: Message edited by: Jorge Baroudi ]
[ November 15, 2005: Message edited by: Jorge Baroudi ]
[ November 15, 2005: Message edited by: Jorge Baroudi ]