question: how long would it take

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Smith

    question: how long would it take

    I am doing some research regarding writing a small webserver in java...

    So my question is:

    How long would it take to write a small webserver in java, by say some
    one who has little experience in java but has a strong programming
    background ?

    Would it be possible to run this from a Windoze CE ?


    Any ideas and links greatly appreciated !
  • Yoyoma_2

    #2
    Re: question: how long would it take

    John Smith wrote:[color=blue]
    > I am doing some research regarding writing a small webserver in java...
    >
    > So my question is:
    >
    > How long would it take to write a small webserver in java, by say some
    > one who has little experience in java but has a strong programming
    > background ?
    >
    > Would it be possible to run this from a Windoze CE ?
    >
    >
    > Any ideas and links greatly appreciated ![/color]


    Well depends on what features you want to support. But i see it as
    maby, if you don't have the knowledge, as a 50 hr job to have a decent
    HTTP 1.1 server going. If you do have experience with parsing and stuff
    you might be looking at around 20 hrs...

    Thats just my estimate.

    Comment

    • Charles Fineman

      #3
      Re: question: how long would it take

      As Torsten said, it's pretty simple. Here is a snippet (for illustration
      only... you could punch many holes in this :-) It does not parse the
      HTTP headers or anything like that, but that's pretty simple.

      public class SampleServer
      {

      public static void main(String[] args)
      {
      if (args.length != 1)
      {
      System.err.prin tln(USAGE);
      }

      int port = -1;

      try
      {
      port = Integer.parseIn t(args[0]);
      }
      catch (NumberFormatEx ception e)
      {
      System.err.prin tln(USAGE);
      System.exit(1);
      }

      try
      {
      ServerSocket ss = new ServerSocket(po rt);
      mDispatchThread = new DispatchThread( ss);
      mDispatchThread .start();
      }
      catch (IOException e)
      {
      DHLLog.getInsta nce().fatal(Sam pleServer.class , "error
      setting up socket", e);
      }
      }

      static class DispatchThread
      extends Thread
      {
      DispatchThread( ServerSocket ss)
      {
      mSS = ss;
      }

      /* (non-Javadoc)
      * @see java.lang.Runna ble#run()
      */
      public void run()
      {
      Socket s = null;
      char[] buffer = new char[1024];

      do {
      try {
      s = mSS.accept();
      }
      catch (IOException e) {
      System.err.prin tln("Error while in accept: " +
      e.getMessage()) ;
      System.exit(1);
      }

      // REQUEST: s.getInputStrea m()
      // RESPONSE: s.getOuputStrea m()
      while (true);

      }

      private boolean mKeepRunning = true;
      private ServerSocket mSS;
      }

      private static final String USAGE = "usage: SampleServer <portNumber>" ;
      }





      John Smith wrote:
      [color=blue]
      > I am doing some research regarding writing a small webserver in java...
      >
      > So my question is:
      >
      > How long would it take to write a small webserver in java, by say some
      > one who has little experience in java but has a strong programming
      > background ?
      >
      > Would it be possible to run this from a Windoze CE ?
      >
      >
      > Any ideas and links greatly appreciated ![/color]

      Comment

      Working...