• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB cannot listen on a socket, but can be a socket client

 
Himai Minh
Ranch Hand
Posts: 1360
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On p. 598 of JSR 318,
An EJB must not attempt to listen on a socket, accept connections on a socket or use a socket for multicast.


The EJB architecture allows an EJB instance to be a network socket client, but it does not allow it to be a server....


I think if the EJB is a socket client, it can listen on a socket and accept connections on a socket.
Do the two quotes conflict with each other?

(I need to be careful about the wording "listen on a socket" and "accept connections on a socket". A client is listening on a socket for incoming messages. Also, a client accepts connections.)
 
Henry Wong
author
Marshal
Pie
Posts: 22092
88
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Himai Minh wrote:
I think if the EJB is a socket client, it can listen on a socket and accept connections on a socket.
Do the two quotes conflict with each other?

(I need to be careful about the wording "listen on a socket" and "accept connections on a socket". A client is listening on a socket for incoming messages. Also, a client accepts connections.)


Your document is using standard TCP socket terminology. If you ever coded at the socket layer for unix, linux, or even Windows, the terms "listen" and "accept" are very clear.

Unfortunately, the Java API tends to hide that terminology. In fact, the only time "listen" and "accept" is even mentioned, is in the JavaDoc of the ServerSocket class. And quite frankly, even then, the JavaDoc assumes that you know the terminology.


Anyway, in Java Speak, it simply means that the EJB can't use the ServerSocket class.

Henry
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic