FileDocCategorySizeDatePackage
StubSocketListener.javaAPI DocExample849Thu Nov 08 00:22:58 GMT 2001com.ora.rmibook.chapter15.impl

StubSocketListener

public class StubSocketListener extends Object implements Runnable

Fields Summary
private int
_port
private StubSender
_sender
Constructors Summary
public StubSocketListener(int portNumber, StubSender sender)

        _port = portNumber;
        _sender = sender;
    
Methods Summary
public voidrun()

        ServerSocket serverSocket;

        try {
            serverSocket = new ServerSocket(_port);
        } catch (Exception e) {
            System.out.println("Unable to vend on port " + _port);
            return;
        }
        while (true) {
            try {
                Socket socket = serverSocket.accept();

                _sender.add(socket);
            } catch (Exception ee) {
                ee.printStackTrace();
            }
        }