Newsgroups: comp.unix.programmer
Subject: writing servers
From: vpopesc@opus.uucp (Gov. Wilson Sucks)
Date: 8 Sep 92 23:03:13 PDT
Distribution: usa
Organization: California State University, Lost Angels

[Hope this doesn't go out in multiplicate. Having posting problems]


Hiya,

I have a few questions relating toa project I'm doing. First, the
project:

 I would like to write a "server" (daemon?) that would process a
 number of connections (internet) using sockets.. (inet,stream)
 I.e. telnet [host] [port]. The server should process all connections,
 and not fork itself for each connection. Just one server, x clients.
 This is SunOS 4.1.2, but I would like it to be portable. This would
 be like ftp, or ircd.. More like ircd tho, since ftpd is
 one server per client.

I have encountered the following problem tho:

 How can I detect if there is activity for the server to process? I
 would like it to be idle as long as it has nothing to do. But all
 I could do was to put it in an infinite loop. And that made it
 eat up 80% cpu, which is prolly unacceptable.

So.. I am appealing to net benevolence for:

 1. Code? Anyone has a small such server that I could follow? I would
    like to write this properly, no hacks. Or, can someone write
    me a quick flowchart on how it should go? Little hints? Do's
    and don'ts? I want it to come out sleek and as efficient as
    possible. I do have experience with Unix programming, I am not a
    total moron, so you don't need to babytalk me. ;) Like I 
    mentioned, I did such a program already, it just wasn't pleased
    with it. (although it worked). If you send code, I promise I'll
    write my own, and not leech your code and call it my own! :)


 2. Can anyone suggest literature on the subject. All I could find was
    books that examined the functions taken apart. How about one that
    says "Ok, here's what goes into writteing a server" ? 

Hope this is clear. I tried to make it as clear as possible without
sounding like a moron. ;)

Thanks.




Newsgroups: comp.unix.programmer
Subject: Writting unix servers
Summary: 
Expires: 
Followup-To: 
Distribution: net
Organization: California State University, Lost Angels
Keywords: 

Hiya,

I have a few questions relating toa project I'm doing. First, the
project:

 I would like to write a "server" (daemon?) that would process a
 number of connections (internet) using sockets.. (inet,stream)
 I.e. telnet [host] [port]. The server should process all connections,
 and not fork itself for each connection. Just one server, x clients.
 This is SunOS 4.1.2, but I would like it to be portable. This would
 be like ftp, or ircd.. More like ircd tho, since ftpd is
 one server per client.

I have encountered the following problem tho:

 How can I detect if there is activity for the server to process? I
 would like it to be idle as long as it has nothing to do. But all
 I could do was to put it in an infinite loop. And that made it
 eat up 80% cpu, which is prolly unacceptable.

So.. I am appealing to net benevolence for:

 1. Code? Anyone has a small such server that I could follow? I would
    like to write this properly, no hacks. Or, can someone write
    me a quick flowchart on how it should go? Little hints? Do's
    and don'ts? I want it to come out sleek and as efficient as
    possible. I do have experience with Unix programming, I am not a
    total moron, so you don't need to babytalk me. ;) Like I 
    mentioned, I did such a program already, it just wasn't pleased
    with it. (although it worked). If you send code, I promise I'll
    write my own, and not leech your code and call it my own! :)


 2. Can anyone suggest literature on the subject. All I could find was
    books that examined the functions taken apart. How about one that
    says "Ok, here's what goes into writteing a server" ? 

Hope this is clear. I tried to make it as clear as possible without
sounding like a moron. ;)

Thanks.

Newsgroups: comp.unix.programmer
Subject: Writting unix servers
Summary: 
Expires: 
Followup-To: 
Distribution: net
Organization: California State University, Lost Angels
Keywords: 

Hiya,

I have a few questions relating toa project I'm doing. First, the
project:

 I would like to write a "server" (daemon?) that would process a
 number of connections (internet) using sockets.. (inet,stream)
 I.e. telnet [host] [port]. The server should process all connections,
 and not fork itself for each connection. Just one server, x clients.
 This is SunOS 4.1.2, but I would like it to be portable. This would
 be like ftp, or ircd.. More like ircd tho, since ftpd is
 one server per client.

I have encountered the following problem tho:

 How can I detect if there is activity for the server to process? I
 would like it to be idle as long as it has nothing to do. But all
 I could do was to put it in an infinite loop. And that made it
 eat up 80% cpu, which is prolly unacceptable.

So.. I am appealing to net benevolence for:

 1. Code? Anyone has a small such server that I could follow? I would
    like to write this properly, no hacks. Or, can someone write
    me a quick flowchart on how it should go? Little hints? Do's
    and don'ts? I want it to come out sleek and as efficient as
    possible. I do have experience with Unix programming, I am not a
    total moron, so you don't need to babytalk me. ;) Like I 
    mentioned, I did such a program already, it just wasn't pleased
    with it. (although it worked). If you send code, I promise I'll
    write my own, and not leech your code and call it my own! :)


 2. Can anyone suggest literature on the subject. All I could find was
    books that examined the functions taken apart. How about one that
    says "Ok, here's what goes into writteing a server" ? 

Hope this is clear. I tried to make it as clear as possible without
sounding like a moron. ;)

Thanks.




Newsgroups: comp.unix.programmer
Subject: Writting unix servers
Summary: 
Expires: 
Followup-To: 
Distribution: net
Organization: California State University, Lost Angels
Keywords: 

Hiya,

I have a few questions relating toa project I'm doing. First, the
project:

 I would like to write a "server" (daemon?) that would process a
 number of connections (internet) using sockets.. (inet,stream)
 I.e. telnet [host] [port]. The server should process all connections,
 and not fork itself for each connection. Just one server, x clients.
 This is SunOS 4.1.2, but I would like it to be portable. This would
 be like ftp, or ircd.. More like ircd tho, since ftpd is
 one server per client.

I have encountered the following problem tho:

 How can I detect if there is activity for the server to process? I
 would like it to be idle as long as it has nothing to do. But all
 I could do was to put it in an infinite loop. And that made it
 eat up 80% cpu, which is prolly unacceptable.

So.. I am appealing to net benevolence for:

 1. Code? Anyone has a small such server that I could follow? I would
    like to write this properly, no hacks. Or, can someone write
    me a quick flowchart on how it should go? Little hints? Do's
    and don'ts? I want it to come out sleek and as efficient as
    possible. I do have experience with Unix programming, I am not a
    total moron, so you don't need to babytalk me. ;) Like I 
    mentioned, I did such a program already, it just wasn't pleased
    with it. (although it worked). If you send code, I promise I'll
    write my own, and not leech your code and call it my own! :)


 2. Can anyone suggest literature on the subject. All I could find was
    books that examined the functions taken apart. How about one that
    says "Ok, here's what goes into writteing a server" ? 

Hope this is clear. I tried to make it as clear as possible without
sounding like a moron. ;)

Thanks.


-- 
_____________     __      ____________ 
\_____      /    /_ \     \     _____/ Valentin Popescu
 \_____     \_____/  \____/     ____/  <vpopesc@opus.calstatela.edu>
  \______________      ____________/   P.O. Box 421181