IPP Mail Archive: IPP> Re: IPP > TES> IBM Client Prototype

IPP> Re: IPP > TES> IBM Client Prototype

Carl Kugler (kugler@us.ibm.com)
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 t=
race
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 th=
e trace
repository.)

This is one of the techniques we plan to use for interoperability testi=
ng.

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

// Server which listens on port 80 and transmits a file called "respons=
e"
// 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 fil=
e
{
Socket readsock;
reader(Socket sock)
{ readsock =3D sock; }
public void run()
{
try
{
byte b[] =3D new byte[32768];
int len =3D 0;
InputStream in =3D readsock.getInputStream();
FileOutputStream fout =3D new FileOutputStream("request");
while ((len =3D in.read(b)) > 0)
fout.write(b, 0, len);
}
catch (Exception e)
{ e.printStackTrace(); }
}
}
class writer implements Runnable // Reads from file, writes to socke=
t
{
Socket writesock;
writer(Socket sock)
{ writesock =3D sock; }
public void run()
{
try
{
byte b[] =3D new byte[32768];
int len =3D 0;
OutputStream out =3D writesock.getOutputStream();
FileInputStream fin =3D new FileInputStream("response");
while ((len =3D fin.read(b)) > 0)
out.write(b, 0, len);
System.err.println("Sent response.");
}
catch (Exception e)
{ e.printStackTrace(); }
}
}
driver() throws IOException
{
ServerSocket listener =3D new ServerSocket(80);
Socket serverSock =3D listener.accept();
System.err.println("Accepted connection.");
Thread t1 =3D new Thread(new reader(serverSock));
Thread t2 =3D 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
---------------------------

ipp-owner@pwg.org on 01/13/98 01:22:53 PM
Please respond to ipp-owner@pwg.org @ internet
To: ipp@pwg.org @ 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 fo=
r.
Unfortunately the client does not do anything unless it is
interacting with an IPP Server. Steve

=