FileDocCategorySizeDatePackage
ListenInside.javaAPI DocExample1146Mon Mar 13 12:24:18 GMT 2000None

ListenInside

public class ListenInside extends Object
ListenInside -- make a server socket that listens only on a particular interface, in this case, one called "inside".
author
Ian F. Darwin
version
$Id: ListenInside.java,v 1.1 2000/03/13 17:24:18 ian Exp $

Fields Summary
public static final short
PORT
The TCP port for the service.
public static final String
INSIDE_HOST
The name of the network interface.
public static final int
BACKLOG
The number of clients allowed to queue
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] argv)


	       
		ServerSocket sock;
		Socket  clientSock;
		try {
			sock = new ServerSocket(PORT, BACKLOG, 
				InetAddress.getByName(INSIDE_HOST));
			while ((clientSock = sock.accept()) != null) {

				// Process it.
				process(clientSock);
			}

		} catch (IOException e) {
			System.err.println(e);
		}
	
static voidprocess(java.net.Socket s)
This would do something with one client.

		System.out.println("Accept from inside " + s.getInetAddress());
		// The conversation would be here.
		s.close();