users@glassfish.java.net

Re: How to create a SocketServer?

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Tue, 08 Jun 2010 12:00:22 +0200

don't you block the thread, which calls init?
There is another possibility to write a custom protocol in GF using
port unification, which will let you share the same TCP port with
other protocols. If you're interested - I can provide you a sample
with instructions.

WBR,
Alexey.

On Jun 6, 2010, at 14:15 , glassfish_at_javadesktop.org wrote:

> I need to create a socket server to listen to port messages from
> inside of Glassfish.
> If I write something simple like the code below, it freezes
> Glassfish during the deployment of the app.
> What is the safe way to implement this functionality?
>
> @Singleton
> @Startup
> public class MySocketServer {
> ServerSocket serverSocket = null;
> @PostConstruct
> private void init() {
> try {
> serverSocket = new ServerSocket(SOCKET_PORT);
> } catch (IOException ex) {
> System.err.println(ex.getMessage());
> }
> //...
> }
> }
> [Message sent by forum member 'denisz']
>
> http://forums.java.net/jive/thread.jspa?messageID=472989
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>