[Jprogramming] fork() sockets on linux
Joe Bogner
joebogner at gmail.com
Wed Jan 22 13:11:16 UTC 2014
I figured it out. I was able to modify the rosetta code web server[1]
example to support multiple concurrent connections using a fork --
just calling fork in libc. To verify, I added a sleep 15 and fired up
multiple requests. Each request completed right after the other. This
means we have a cross platform way of handling multiple long running
requests.
[1] - http://rosettacode.org/wiki/Hello_world/Web_server#J
On Tue, Jan 21, 2014 at 7:45 PM, Joe Bogner <joebogner at gmail.com> wrote:
> Has anyone tackled using fork() with sockets on linux to enable
> parallel request handling?
>
> On the surface it looks like 2:!2 won't do what I need it to do
> (https://github.com/openj/core/blob/master/xh.c) since it appears to
> shell out the supplied program instead of providing a facility to keep
> processing in the forked process.
>
> I have an implementation on windows and wanted to support it on linux as well.
>
> http://www.jsoftware.com/help/dictionary/dx002.htm
More information about the Programming
mailing list