Discussions

EJB design: Can EJBs use Sockets to communicate?

  1. Can EJBs use Sockets to communicate? (3 messages)

    Hello -
    I need to communicate with a Java application from an EJB(session bean). Is it possible to place code for a client socket inside a method somewhere in the Bean, and have it comm. with a server socket in another application...(the server socket establishes a connection and listens for requests from the client)...?

    Thanks!
  2. yes u can definitely create socket connections to communicate with other services/application.

    but u have to be careful how u use it. u have to consider design n technical issues. if u r only using the client cocket to connect to a server socket and then write a stream of data, then u r ok. but if u want ur client socket to listen for data, then u will be blocking ur synchronous ejb call or else u will end up creating thread which ejb doesnt encourage.
  3. As a socket client you are fine. The EJB spec does not allow listening on a socket within an EJB.

    Chz

    Tony
  4. Will you please send me the examples( or sites ) for doing
    sockets communication with Ejb & Client (Java,C++ )?

    Thanx in advanced.
    Devendra