You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Techie India <it...@gmail.com> on 2007/09/04 07:23:40 UTC

Regarding Async server in NIO Example

Hi,

Going through the examples i find that we can build Async Server with NIO
Module, Can we do the same thing with the Classic I/O module.

One more thing, is there any thing in NIO Module through which we can set a
backlog limit for the server socket, if not then what is the default value
for that.



Thanks,
Techie India

Re: Regarding Async server in NIO Example

Posted by Roland Weber <os...@dubioso.net>.
Techie India wrote:
> Actually i mean whether we can create a Async Server with the Classic I/O
> Module.

No. The classic I/O model is blocking and therefore not async.
You can implement asynchronous communication on blocking IO
only by starting background threads in plenty. HttpCore makes
no provisions for that. Of course you're free to implement that
in your application.

cheers,
  Roland




---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Re: Regarding Async server in NIO Example

Posted by Techie India <it...@gmail.com>.
Actually i mean whether we can create a Async Server with the Classic I/O
Module.

By backlog limit i mean the acceptCount parmeter of the ServerSocket.


On 9/4/07, Oleg Kalnichevski <ol...@apache.org> wrote:
>
> On Tue, 2007-09-04 at 10:53 +0530, Techie India wrote:
> > Hi,
> >
> > Going through the examples i find that we can build Async Server with
> NIO
> > Module, Can we do the same thing with the Classic I/O module.
> >
>
> Yes, of course
>
>
> http://svn.apache.org/repos/asf/jakarta/httpcomponents/httpcore/tags/4.0-alpha5/module-main/src/examples/org/apache/http/examples/ElementalHttpServer.java
>
>
> > One more thing, is there any thing in NIO Module through which we can
> set a
> > backlog limit for the server socket, if not then what is the default
> value
> > for that.
> >
>
> What do you mean by the 'backlog limit for the server socket'? Maximum
> content buffer length?
>
> Oleg
>
> >
> >
> > Thanks,
> > Techie India
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> httpcomponents-dev-help@jakarta.apache.org
>
>

Re: Regarding Async server in NIO Example

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2007-09-04 at 10:40 +0200, Ortwin Glück wrote:
> 
> Oleg Kalnichevski wrote:
> > What do you mean by the 'backlog limit for the server socket'? Maximum
> > content buffer length?
> 
> I think he refers to the number of not-yet-accepted TCP connections (SYN
> received, but not ACKed). See second parameter of ServerSocket(int,
> int). Basically connections must be accepted one by one. But in the
> meantime the connections keep queuing up until the backlog limit is
> reached. From that point on new connections will get a RST packet instead.
> 
> Odi
> 

I see. NIO does not seem to expose this option because the server socket
get instantiated behind the scene by the ServerSocketChannel. So the
system default should apply.

Oleg   

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Re: Regarding Async server in NIO Example

Posted by Ortwin Glück <od...@odi.ch>.

Oleg Kalnichevski wrote:
> What do you mean by the 'backlog limit for the server socket'? Maximum
> content buffer length?

I think he refers to the number of not-yet-accepted TCP connections (SYN
received, but not ACKed). See second parameter of ServerSocket(int,
int). Basically connections must be accepted one by one. But in the
meantime the connections keep queuing up until the backlog limit is
reached. From that point on new connections will get a RST packet instead.

Odi

---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Re: Regarding Async server in NIO Example

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2007-09-04 at 10:53 +0530, Techie India wrote:
> Hi,
> 
> Going through the examples i find that we can build Async Server with NIO
> Module, Can we do the same thing with the Classic I/O module.
> 

Yes, of course

http://svn.apache.org/repos/asf/jakarta/httpcomponents/httpcore/tags/4.0-alpha5/module-main/src/examples/org/apache/http/examples/ElementalHttpServer.java


> One more thing, is there any thing in NIO Module through which we can set a
> backlog limit for the server socket, if not then what is the default value
> for that.
> 

What do you mean by the 'backlog limit for the server socket'? Maximum
content buffer length?

Oleg

> 
> 
> Thanks,
> Techie India


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org