Article View: comp.lang.java
Article #550Re: UNIX like select() for Java!
From: Mark Frazier
Date: Wed, 17 Dec 1997 00:00
Date: Wed, 17 Dec 1997 00:00
22 lines
2255 bytes
2255 bytes
> The xware.net.Selector class provides an event-driven mechanism for > handling input from > multiple sockets. It is ideal for writing server like Java applets or > applications. It can be used > on both the client or server side of your sockets based interface. Thanks for this. However, isn't more "java like" to take the approach of running every socket in a new thread? I've done this in Java servers. You start up a Java server socket, and everytime you get a connection, you run a new thread which is a class that serves only that socket. The code is pretty trivial. Of course, if you need to co-ordinate the inputs from all the differen sockets, you would then implement some kind of <synchronized> callback mechanism (like passing a reference to a common class which is "Mediator" type of design pattern). Of course, I guess the differences between this and your approach might be rather subtle?
Technical Details
Message-ID:
<34984761.369C83CC@rmi.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<34973C27.759E1BA4@bellatlantic.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10a146,aee69011bb9ffa08 X-Google-Attributes: gid10a146,public X-Google-Thread: 111d6b,aee69011bb9ffa08 X-Google-Attributes: gid111d6b,public X-Google-Thread: f5d71,aee69011bb9ffa08 X-Google-Attributes: gidf5d71,public X-Google-Thread: 1291f0,aee69011bb9ffa08 X-Google-Attributes: gid1291f0,public X-Google-Thread: 107d55,aee69011bb9ffa08 X-Google-Attributes: gid107d55,public X-Google-Thread: 112e38,aee69011bb9ffa08 X-Google-Attributes: gid112e38,public X-Google-Thread: 1089d0,aee69011bb9ffa08 X-Google-Attributes: gid1089d0,public X-Google-Thread: f4bc9,aee69011bb9ffa08 X-Google-Attributes: gidf4bc9,public From: Mark Frazier <mfrazier@rmi.net> Subject: Re: UNIX like select() for Java! Date: 1997/12/17 Message-ID: <34984761.369C83CC@rmi.net> X-Deja-AN: 299137206 Content-Transfer-Encoding: 7bit References: <34973C27.759E1BA4@bellatlantic.net> To: plm@bellatlantic.net Content-Type: text/plain; charset=us-ascii Organization: Support Request Mime-Version: 1.0 Newsgroups: comp.lang.java,comp.lang.java.misc,comp.lang.java.programmer,comp.lang.java.tech,borland.public.jbuilder.thirdpartytools,borland.public.jbuilder.java.api,symantec.support.devtools.pc.visual-cafe-pro.using,symantec.support.devtools.windows.vcafe4java.Other