接动作侦听器在Java [英] Sockets Action Listener in java
问题描述
大家您好,:)
I''m发展与Java客户端和服务器的红宝石多客户端服务器应用程序,我要听的是由服务器发送并更新客户端根据该消息出来使用循环一样,而(真)消息来听套接字消息,
因此,如果发现套接字通知我服务器是否有新消息通知,我需要对套接字使用操作侦听器,然后我将读取此消息并更新客户端.
谁能帮助我,或是否有解决这个问题的任何替代方法. :)
在此先感谢:玫瑰:
[请详细说明的问题,如果有更多的信息]
假设您的服务器已发布细到所有客户端的工作,它是在客户端的连接需要倾听.
我会把你的在自己的线程,以便它不会锁定用户界面,然后只听入站流.
看看这里 [的 ^ ].
Hi everybody, :)
I''m developing multi client server application with java clients and ruby server and I need to listen to the message that sent by the server and updates the clients according to this messages with out using loops like while(true) to listen to socket messages ,
so i need to use action listener for sockets if its found to notify me if there is new message coming from the server then i will read this message and update the clients .
can anyone can help me or if there is any alternative way to solve this problem. :)
Thanks in advance:rose:
[Please elaborate the question if there is more information]
Working on the assumption that your server is publishing fine to all the clients, it is the connection at the client end that needs to listen.
I would put yourSocket
in its own thread so that it does not lock the UI, then just listen on the inbound stream.
have a look here[^].
这篇关于接动作侦听器在Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!