[6012] in java-interest

home help back first fref pref prev next nref lref last post

Re: implementing a server in Java...

daemon@ATHENA.MIT.EDU (Jay Allen)
Thu Mar 14 17:38:42 1996

Date:         Thu, 14 Mar 1996 16:16:03 EST
Reply-To: Java Interest <JAVA-INTEREST@JAVASOFT.COM>
From: Jay Allen <jayallen@KODAK.COM>
To: Multiple recipients of list JAVA-INTEREST
              <JAVA-INTEREST@JAVASOFT.COM>
In-Reply-To:  <199603140817.AAA16298@dns2.noc.best.net>; from "dc" at Mar 14,
              96 12:17 (midnight)

Hi,

Writing an Internet server is a bit more complicated than just instantiating a socket. The basics of server creation can be grokke dby reading "Using C
On the Unix System," which contains a whole chapter on networking.
(You might also find some info in the rather large book "Unix Network
Programming"; I can't say for certain, because I haven't read it yet.)
Briefly, here's what a server must do:

- Instantiate a socket
- *Bind* its network name and port number to that socket.
- Listen for incoming requests (done by using the listen() command in
  both Perl and C)
- Accept connection requests. At this point, the server traditionally will
  fork, allowing the child to handle the connection while the parent
  waits for more requests. Not all servers fork, though; Apache (a Web
  server based on NCSA's httpd) is a notable exception.
- Close the connection gracefully.

There are, as you suspected, other ancillary concerns. E.g., only superuser
can use port numbers below a certain integer (I believe it's 124, but I
could certainly be wrong).

As for writing individual servers to handle single applets: You're right, that
would bog down Unix systems. I think distributed object technology would
solve this, however.

Hope this gives you a good head start!

--

"Defaults are wonderful, just like fire."
        - Larry Wall, in response to a Usenet post
                      praising Perl's defaults

This message does not necessarily reflect the opinions of
Eastman Kodak Company.

home help back first fref pref prev next nref lref last post