Re: Looking for a NIO client/server example

From: Vincent Cantin (Pere.Noel_at_lutin.fr)
Date: 02/25/05


Date: Fri, 25 Feb 2005 20:34:01 +0800


"Chris Berg" <spame@eggs.spam> ???
news:dpst11p2ibfkk6ai1iet8hogniabm221pp@4ax.com ???...
> My client/server application works with sockets, one for each user,
> the sockets remain open for the entire session. Each client has a
> separate thread on the server. A traditional design, but limited in
> the max. number of conccurrent clients.
>
> I think using non-blocking NIO should be able to greatly enhance the
> system. However, there are two obstacles:
>
> 1) I need to re-write the thread code, especially the logic for
> creation/destruction of a session, as there is now no thread that
> governs the state of a user. This involves creating a state-vector and
> a state-machine. But I can see a way through that.
>
> 2) I need to understand NIO in more detail. Looking at Sun's examples,
> it looks quite a bit more complicates that old IO. Specifically, my
> protocol has telegrams whose size can only be determined at run-time,
> an that are in principle limitless. As I understand the NIO socket
> handling, this complicates matters quite a bit as it uses fixed-size
> buffers, but I may have misunderstood something.
>
> So, my question:
>
> Does anyone know of an example somewhere on the web that can be used
> as a pattern?
>
> Chris

Hi Chris,

Take a look on the JNAG project : https://jnag.dev.java.net/
Even if it is still in prototype version, it may help you to understand how
NIO works and how to use it.

Vincent



Relevant Pages

  • Looking for a NIO client/server example
    ... My client/server application works with sockets, one for each user, ... the sockets remain open for the entire session. ... I need to understand NIO in more detail. ...
    (comp.lang.java.programmer)
  • Re: Regarding CArchive,Files and CSockets
    ... Essentially each connection on the client/server side uses this type of code: ... CSocketFile and CArchive classes to allow data to be streamed into out of the ... Years ago I first learned about sockets in MFC the way you are going: ...
    (microsoft.public.vc.mfc)
  • Re: Sockets and Notification
    ... "Ali R." ... > I have a client/server application talking to each other using streaming ... > sockets. ... > Anyway, Lets say I want to call a method in the communication class, tell ...
    (microsoft.public.vc.mfc)
  • Re: Using COM for interprocess communication?
    ... the best replacement for a socket is not RPC ... I suggest you use pipes instead. ... These are much closer to sockets ... I have a client/server application which I want to ...
    (microsoft.public.win32.programmer.ole)
  • Re: What do you call this socket?
    ... >Robert Swinney wrote: ... >> Chris, ... >> and plugs as long as they have 4 prongs arnd are heavy enough to carry the ... I would buy new sockets, ...
    (rec.crafts.metalworking)