Le 21/02/15 21:16, Abeer Al-Anazi a écrit :
> I created a function in clientSessionHandler to receive the updated data.
> and I use the session in clientSessionHandler to write it. but when I call
> this function in my class several times like this:
> ClientSessionHandler j = new ClientSessionHandler(obj);
> try {
> while (true){
> j.reciveDataFromClient(this.id, this.salary);
> Thread.sleep(1000, 5);}
> } catch(InterruptedException ie) {}
> the client does not work. But when I call it without repeat like this, it
> is work!
> ClientSessionHandler j = new ClientSessionHandler(obj);
> j.reciveDataFromClient(this.id, this.salary);
You are confusing things. MINA is an asynchronous framework. In other
words, you will be called when the client receives something, you don't
have to loop waiting for something to be received.
Your client is already *listening* for incoming event from the server,
and this has to be handled in the messaegReceived() method of your handler.