digitalmars.D - inetd or super-server in D :-)
- Robert (7/7) Sep 16 2008 I code super-server in D(simple implementation of something like "inetd"...
- Janderson (4/11) Sep 16 2008 Hi Robert I don't have the answer to your problem, sorry. However you
- Robert (2/14) Sep 16 2008
- Robert (2/14) Sep 16 2008
- Janderson (32/54) Sep 17 2008 Hi Robert, I didn't mean any offense by my message. Also note I'm
- Benji Smith (13/30) Sep 17 2008 I understood the question.
- Janderson (7/44) Sep 17 2008 Knowing the lingo sure would help. I thought someone might be able to
- Lars Ivar Igesund (7/16) Sep 17 2008 Can I suggest that you look at the io.selector package in Tango?
- Tristam MacDonald (6/7) Sep 19 2008 In theory yes, this is how mush *nix daemons are implemented. The
- Chris R. Miller (5/12) Sep 19 2008 http://www.enderunix.org/docs/eng/daemon.php
- Bruce Adams (9/27) Sep 20 2008 Ah 2001 before spelling hit the internet. Its nice to have standarts.
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.
Sep 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
Sep 16 2008
Janderson Wrote:Robert wrote:How?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
Sep 16 2008
Janderson Wrote:Robert wrote:So my english is so bad?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
Sep 16 2008
Robert wrote:Janderson Wrote: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:Robert wrote:So my english is so bad?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"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.I code super-server in D(simple implementation of something likethe 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.- how super-server can realize the port of connection request ofargument of the function ? - Do I trigger "exec" with the ??proper server?? as an argument of the function after a "fork"? * ?? What is proper server?-after "fork" do I just trigger "exec" with proper server as anexec(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 ;)-should I trigger everything via TCPD? (because simple version withconst 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.- to close all file descriptors I have problem with usage of NOFILEHow 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. -Joelhow this thing should look in D?
Sep 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
Sep 17 2008
Benji Smith wrote:Janderson wrote: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* ? 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
Sep 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
Sep 17 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.
Sep 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.
Sep 19 2008
On Fri, 19 Sep 2008 19:16:41 +0100, Chris R. Miller <lordsauronthegreat gmail.com> wrote:Robert wrote:Ah 2001 before spelling hit the internet. Its nice to have standarts. That's a handy link. Its also work looking at Stevens - "Advanced Programming in the Unix Environment": http://www.amazon.com/Programming-Environment-Addison-Wesley-Professional-Computing/dp/0201563177 And the art of unix programming is woth a read too: http://www.faqs.org/docs/artu/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.
Sep 20 2008