Subject: IPP> Re: IPP > TES> IBM Client Prototype

From: Carl Kugler <[email-masked]>
Date: Thu, 15 Jan 1998 15:04:01 -0500

Puru-

As Steve says below, the IPP Client is useless without an IPP Server.  However,
one can make a "pretend" IPP server by using a driver to serve binary trace
files such as

 ftp://ftp.pwg.org/pub/pwg/ipp/new_TES/Traces/00012B00.trc

(See http://www.pwg.org/hypermail/ipp/2911.html for a description of the trace
repository.)

This is one of the techniques we plan to use for interoperability testing.

Here is some example Java 1.1 code for a simple driver:

// Server which listens on port 80 and transmits a file called "response"
// after accepting a connection.  Records data read from client in
// file called "request".

import java.io.*;
import java.net.*;

public class driver
   {
   class reader implements Runnable // Reads from socket, writes to file
      {
      Socket readsock;
      reader(Socket sock)
         { readsock = sock; }
      public void run()
         {
         try
            {
            byte b[] = new byte[32768];
            int len = 0;
            InputStream in = readsock.getInputStream();
            FileOutputStream fout = new FileOutputStream("request");
            while ((len = in.read(b)) > 0)
               fout.write(b, 0, len);
            }
         catch (Exception e)
            { e.printStackTrace(); }
         }
      }
   class writer implements Runnable // Reads from file, writes to socket
      {
      Socket writesock;
      writer(Socket sock)
         { writesock = sock; }
      public void run()
         {
         try
            {
            byte b[] = new byte[32768];
            int len = 0;
            OutputStream out = writesock.getOutputStream();
            FileInputStream fin = new FileInputStream("response");
            while ((len = fin.read(b)) > 0)
               out.write(b, 0, len);
            System.err.println("Sent response.");
            }
         catch (Exception e)
            { e.printStackTrace(); }
         }
      }
   driver() throws IOException
      {
      ServerSocket listener = new ServerSocket(80);
      Socket serverSock = listener.accept();
      System.err.println("Accepted connection.");
      Thread t1 = new Thread(new reader(serverSock));
      Thread t2 = new Thread(new writer(serverSock));
      t1.start();
      t2.start();
      }
   public static void main(String argv[]) throws IOException
      { new driver(); }
   }

// Carl Kugler
// IBM

---------------------- Forwarded by Carl Kugler/Boulder/IBM on 01/15/98 10:18 AM
 ---------------------------

[email-masked] on 01/13/98 01:22:53 PM
Please respond to [email-masked] @ internet
To: [email-masked] @ internet
cc:
Subject: IPP> IPP > IBM Client Prototype

Puru, The client prototype attempts to connect to an IPP Server before
      performing any data stream writes. As a result, in your case,
      you get an exception that we have not provided an error dialog for.
      Unfortunately the client does not do anything unless it is
      interacting with an IPP Server.  Steve