Thanks for your responses.  I guess I should use sockets.

> your own communcation protocol, could do things at a lower level,
> could keep the sockets open, etc.  With servlets, you're stuck using
> http -- e.g. the request/response mechanism, you'd have to "translate"

How do you keep a socket open? In the following threaded code, things seemed to
block unless I close the socket:

  public void run(){
    BufferedReader in = null;
    PrintWriter out = null;
    try{
      in = new BufferedReader(new InputStreamReader(client.getInputStream()));
      out = new PrintWriter(client.getOutputStream(), true);
    } catch (IOException e) {
      System.err.println("in or out failed for client");
      System.exit(-1);
    }

    String eui;

    try {
      eui = in.readLine();
      while (eui != null) {
        System.err.println ("Processing: " + eui);
        String euixml = Eui2Xml.getXml(eui);
        //Send data back to client
        out.println(euixml); // blocks
        eui = in.readLine(); // <== never gets here
      }
    }
    catch (Exception excp) {
      System.err.println (excp.toString());
      System.exit(-1);
    }

  }


--
                                          myriam

Go Proverb:

Dead group? Always win ko fights!

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to