从客户端到服务器,我用的是ejb,客户端只需要知道服务器的名字和ejb的接口就可以了,与IP地址无关,我希望用ejb来实现服务器到客户端的通信,该怎样做?

解决方案 »

  1.   

    You might want to study design pattern in MVC :)
    It decoupling objects so that changes to one(model) can affect any number of others(views) without requiring the changed object to know details of the others ... To make it more reliability and scalablity you need read more info such as JMS(publish/subscribe messaging), j2ee(connector) and so on.Good luck!
      

  2.   

    普博大虾,你好。谢谢你的指教,我用的是JBuilder 4.0和BAS4.5,好像只支持EJB1.1,JMS只在EJB2.0中才有。怎么办啊?
      

  3.   

    你意思是什么?是说,服务器端要主动去和客户端通信么?这个我想jms应该可以办到但你说不支持ejb2.0所以我觉得有server端发起的的从服务器到客户端界面的通信,不太可行!----(望高手指教)那么,这样如何,你让客户端定期刷新(每隔若干秒)去调用一下你bean中的方法--向那种古老的聊天是一样(pull)当然,你的每个客户端都实现必须与服务器连上,如果你用一个stateful来代表客户端在用个entityBean来访问数据库中的通信接口返回的信息或是stateless bean 直接 访问 通信接口返回的信息我的拙见--你再看看
      

  4.   

    只要你的server够牛,没问题我想或者,可以负载均衡,多几台机器一起来做server----这只是文档上看到--还没听说谁这么干过,成本高了点,不过ejb就是花钱的东西,那怎么办?我和你一样期待着高的解决方案(非jms的)
    -----------------jms真有用呀!---还是jms好!
      

  5.   

    谢谢热心的lanlansky,请你继续关注我的问题哦。
    顺便问一句,如果用jms的话,我该看看哪些方面的资料?指点指点哦。
      

  6.   

    JavaTM Message Service Tutorial 1.3 Beta Releasej2sdkee1.3 的文档--足够了! ----这方面我了解也不多--只是皮毛大家一起学!
      

  7.   

    Messaging 是组件和应用程序之间互相通讯的一种方法!messaging 系统是一个对等的系统
    :每个客户端都连接到一个代理上,它提供了创建消息,发消息,收消息的功能,使任一个messaging 的客户端可以与其他客户端交换消息。
    Messaging 以松耦合的方式实现分布式的通讯。一个组件发一个消息到一个已知的位置,需要接受消息的一端也从那里得到消息,也就是说,发送方和接受方不用同时在线,实施上,发方和收方彼此可以互不相知他们只需要知道消息的格式和那个已知的位置,在这种关系下,Messaging 区别于相对紧耦合的rmi!
    What Is Messaging?
    Messaging is a method of communication between software components or applications. A messaging system is a peer-to-peer facility: a messaging client can send messages to, and receive messages from, any other client. Each client connects to a messaging agent that provides facilities for creating, sending, and receiving messages. 
    Messaging enables distributed communication that is loosely coupled. A component sends a message to a destination, and the recipient can retrieve it from the destination. However, the sender and receiver do not have to be available at the same time in order to communicate. In fact, the sender does not need to know anything about the receiver, nor does the receiver need to know anything about the sender; they only need to know what message format and what destination to use. In this respect, messaging differs from tightly coupled technologies such as Remote Method Invocation (RMI), which require an application to know a remote application's methods. Messaging also differs from electronic mail (e-mail), which is a method of communication between people, or between software applications and people. Messaging is used for communication between software applications or software components. 
      

  8.   

    你说的j2sdkee1.3 文档哪里有啊?还有上面的这些是从哪里弄来的?有中文的最好,没有中文的,只好多花时间去读。
    谢谢大虾!!
      

  9.   

    lanlansky,还有各位大虾,回答我的问题吧。