Jump to page: 1 2
Thread overview
inetd or super-server in D :-)
Sep 16, 2008
Robert
Sep 16, 2008
Janderson
Sep 16, 2008
Robert
Sep 17, 2008
Robert
Sep 17, 2008
Janderson
Sep 17, 2008
Benji Smith
Sep 18, 2008
Janderson
Sep 17, 2008
Lars Ivar Igesund
Sep 19, 2008
Tristam MacDonald
Sep 19, 2008
Chris R. Miller
Sep 20, 2008
Bruce Adams
September 16, 2008
I code super-server in D(simple implementation of something like "inetd" does). To select attempt of connection I use modules of class Selector. My problems:
- how super-server can realize the port of connection request of the client, to provide proper request-handle procedure?
-after "fork" do I just trigger "exec" with proper server as an argument of the function   ?
-should I trigger everything via TCPD? (because simple version with exec(serverd,....) doesn't work properly on my ubuntu)?
- to close all file descriptors I have problem with usage of NOFILE const or RLIMIT_NOFILE?
how this thing should look in D?
Thanks for any tips.
September 16, 2008
Robert wrote:
> I code super-server in D(simple implementation of something like "inetd" does). To select attempt of connection I use modules of class Selector. My problems:
> - how super-server can realize the port of connection request of the client, to provide proper request-handle procedure?
> -after "fork" do I just trigger "exec" with proper server as an argument of the function   ?
> -should I trigger everything via TCPD? (because simple version with exec(serverd,....) doesn't work properly on my ubuntu)?
> - to close all file descriptors I have problem with usage of NOFILE const or RLIMIT_NOFILE?
> how this thing should look in D?
> Thanks for any tips. 

Hi Robert I don't have the answer to your problem, sorry.  However you might try posting in your native language as well.  You might get lucky.

-Joel
September 16, 2008
Janderson Wrote:

> Robert wrote:
> > I code super-server in D(simple implementation of something like "inetd" does). To select attempt of connection I use modules of class Selector. My problems:
> > - how super-server can realize the port of connection request of the client, to provide proper request-handle procedure?
> > -after "fork" do I just trigger "exec" with proper server as an argument of the function   ?
> > -should I trigger everything via TCPD? (because simple version with exec(serverd,....) doesn't work properly on my ubuntu)?
> > - to close all file descriptors I have problem with usage of NOFILE const or RLIMIT_NOFILE?
> > how this thing should look in D?
> > Thanks for any tips.
> 
> Hi Robert I don't have the answer to your problem, sorry.  However you might try posting in your native language as well.  You might get lucky.
 How?
> -Joel

September 17, 2008
Janderson Wrote:

> Robert wrote:
> > I code super-server in D(simple implementation of something like "inetd" does). To select attempt of connection I use modules of class Selector. My problems:
> > - how super-server can realize the port of connection request of the client, to provide proper request-handle procedure?
> > -after "fork" do I just trigger "exec" with proper server as an argument of the function   ?
> > -should I trigger everything via TCPD? (because simple version with exec(serverd,....) doesn't work properly on my ubuntu)?
> > - to close all file descriptors I have problem with usage of NOFILE const or RLIMIT_NOFILE?
> > how this thing should look in D?
> > Thanks for any tips.
> 
> Hi Robert I don't have the answer to your problem, sorry.  However you might try posting in your native language as well.  You might get lucky.

So my english is so bad?
> -Joel

September 17, 2008
Robert wrote:

> I code super-server in D(simple implementation of something like "inetd"
> does). To select attempt of connection I use modules of class Selector. My
> problems: - how super-server can realize the port of connection request of
> the client, to provide proper request-handle procedure?
> -after "fork" do I just trigger "exec" with proper server as an argument
> of the function   ? -should I trigger everything via TCPD? (because simple
> version with exec(serverd,....) doesn't work properly on my ubuntu)? - to
> close all file descriptors I have problem with usage of NOFILE const or
> RLIMIT_NOFILE? how this thing should look in D? Thanks for any tips.

Can I suggest that you look at the io.selector package in Tango?

-- 
Lars Ivar Igesund
blog at http://larsivi.net
DSource, #d.tango & #D: larsivi
Dancing the Tango
September 17, 2008
Robert wrote:
> Janderson Wrote:
> 
>> Robert wrote:
>>> I code super-server in D(simple implementation of something like "inetd" does). To select attempt of connection I use modules of class Selector. My problems:
>>> - how super-server can realize the port of connection request of the client, to provide proper request-handle procedure?
>>> -after "fork" do I just trigger "exec" with proper server as an argument of the function   ?
>>> -should I trigger everything via TCPD? (because simple version with exec(serverd,....) doesn't work properly on my ubuntu)?
>>> - to close all file descriptors I have problem with usage of NOFILE const or RLIMIT_NOFILE?
>>> how this thing should look in D?
>>> Thanks for any tips. 
>> Hi Robert I don't have the answer to your problem, sorry.  However you might try posting in your native language as well.  You might get lucky.
> 
> So my english is so bad? 
>> -Joel
> 

Hi Robert,  I didn't mean any offense by my message.    Also note I'm not the best English speaker in the world myself, even though it is my native language.  I've put * where I've made comments.

If I was to translate what I thought you meant I would write:


>>> I code super-server in D(simple implementation of something like "inetd" does). To select attempt of connection I use modules of class Selector. My problems:

I coded a super-server in D which is similar to "inetd".  To initate a connection I used the class Selector Module.  Anyway how can I solve these problems:

* ? What is super-server. Context would help when trying to translate this.

>>> - how super-server can realize the port of connection request of the client, to provide proper request-handle procedure?

* I'm not exactly sure what you mean here but I'll take 2 stabs *

- How can I find the port the client made the request on.
- How can I hand shake with the client to make a connection to the server.

>>> -after "fork" do I just trigger "exec" with proper server as an argument of the function   ?

- Do I trigger "exec" with the ??proper server?? as an argument of the function after a "fork"?

* ?? What is proper server?

>>> -should I trigger everything via TCPD? (because simple version with exec(serverd,....) doesn't work properly on my ubuntu)?

- should I trigger everything via TCPD? The simple version with exec(serverd,....) doesn't work properly on ubuntu for me.

* Ok, I think that was written in an understanding way ;)

>>> - to close all file descriptors I have problem with usage of NOFILE const or RLIMIT_NOFILE?

- NOFILE const or RLIMIT_NOFILE doesn't seem to close all file descriptors.  Any suggestions?

* Technically you might provide more information here.

>>> how this thing should look in D?

How would the code for my app look in D?


I guess if someone took a little more time they may have been able to translate some of what you where asking.  I guess one of the main things you do is leave out "a"'s and "the"'s.  I hope that was helpful.

-Joel
September 17, 2008
Janderson wrote:
> * ? What is super-server. Context would help when trying to translate this.
> 
>  >>> - how super-server can realize the port of connection request of the client, to provide proper request-handle procedure?
> 
> * I'm not exactly sure what you mean here but I'll take 2 stabs *
> 
> - How can I find the port the client made the request on.
> - How can I hand shake with the client to make a connection to the server.
> 
>  >>> -after "fork" do I just trigger "exec" with proper server as an argument of the function   ?
> 
> - Do I trigger "exec" with the ??proper server?? as an argument of the function after a "fork"?
> 
> * ?? What is proper server?

I understood the question.

A "super server" is terminology for a linux daemon like "inted" or "xinetd" which listens for certain incoming protocol events, determines the appropriate server to invoke, and passes the request to that server.

A super server allows a single daemon to manage the servers for a bunch of different protocols, so that you can consolidate their configuration (and you don't need to have, for example pop3d, running 24 hours a day; only when pop3 requests are handled).

Having said all that, I don't know anything about how to implement a super server in D. But I thought the questions were unambiguous, at least for someone who knows the background info about linux daemons.

--benji
September 18, 2008
Benji Smith wrote:
> Janderson wrote:
>> * ? What is super-server. Context would help when trying to translate this.
>>
>>  >>> - how super-server can realize the port of connection request of the client, to provide proper request-handle procedure?
>>
>> * I'm not exactly sure what you mean here but I'll take 2 stabs *
>>
>> - How can I find the port the client made the request on.
>> - How can I hand shake with the client to make a connection to the server.
>>
>>  >>> -after "fork" do I just trigger "exec" with proper server as an argument of the function   ?
>>
>> - Do I trigger "exec" with the ??proper server?? as an argument of the function after a "fork"?
>>
>> * ?? What is proper server?
> 
> I understood the question.
> 
> A "super server" is terminology for a linux daemon like "inted" or "xinetd" which listens for certain incoming protocol events, determines the appropriate server to invoke, and passes the request to that server.
> 
> A super server allows a single daemon to manage the servers for a bunch of different protocols, so that you can consolidate their configuration (and you don't need to have, for example pop3d, running 24 hours a day; only when pop3 requests are handled).
> 
> Having said all that, I don't know anything about how to implement a super server in D. But I thought the questions were unambiguous, at least for someone who knows the background info about linux daemons.
> 
> --benji

Knowing the lingo sure would help.  I thought someone might be able to figure out Roberts email based off the keywords.  It was possible that given the way it was written that it was something that Robert had made so I thought I'd better speak up, rather then let Roberts question fall to the wayside.  I guess I should have asked the all-knowing google first.

-Joel
September 19, 2008
Robert wrote:
> -after "fork" do I just trigger "exec" with proper server as an argument of the function   ?
In theory yes, this is how mush *nix daemons are implemented. The launcher program forks, execs the server program in the child process, and then exits from the parent process.

Note that the server process will share the parent proccess' stdin/stdout/stderr, unless you explicitly change them.
September 19, 2008
Robert wrote:
> I code super-server in D(simple implementation of something like "inetd" does). To select attempt of connection I use modules of class Selector. My problems:
> - how super-server can realize the port of connection request of the client, to provide proper request-handle procedure?
> -after "fork" do I just trigger "exec" with proper server as an argument of the function   ?
> -should I trigger everything via TCPD? (because simple version with exec(serverd,....) doesn't work properly on my ubuntu)?
> - to close all file descriptors I have problem with usage of NOFILE const or RLIMIT_NOFILE?
> how this thing should look in D?
> Thanks for any tips. 

http://www.enderunix.org/docs/eng/daemon.php

This is the definitive guide for server programming on UNIX platforms. Note that most of these functions are hiding in unistd.h.  You can get them by importing the D bindings to the C standard library.
« First   ‹ Prev
1 2