/** * Accepts a single inbound connection if the same ServerSocket is used for * all message exchanges, or a connection from each if two ServerSockets are * being used. * * @param theAddress the IP address from which to accept connections (null means * accept from any address). Connection attempts from other addresses will * be ignored. * @return a <code>Processor</code> connected to the given address * @throws TransportException */ public Processor accept(String theAddress) throws TransportException { TransportLayer transport = getTransport(myServerSocket, theAddress); ProcessorContext context = null; if (myServerSocket2 == null) { //we're doing inbound & outbound on the same port transport.connect(); context = new ProcessorContextImpl(myRouter, transport, myStorage); } else { TransportLayer transport2 = getTransport(myServerSocket2, theAddress); DualTransportConnector connector = new DualTransportConnector(transport, transport2); connector.connect(); context = new ProcessorContextImpl(myRouter, transport, transport2, myStorage); } return new ProcessorImpl(context, true); }
/** * Accepts a single inbound connection if the same ServerSocket is used for * all message exchanges, or a connection from each if two ServerSockets are * being used. * * @param theAddress the IP address from which to accept connections (null means * accept from any address). Connection attempts from other addresses will * be ignored. * @return a <code>Processor</code> connected to the given address * @throws TransportException */ public Processor accept(String theAddress) throws TransportException { TransportLayer transport = getTransport(myServerSocket, theAddress); ProcessorContext context = null; if (myServerSocket2 == null) { //we're doing inbound & outbound on the same port transport.connect(); context = new ProcessorContextImpl(myRouter, transport, myStorage); } else { TransportLayer transport2 = getTransport(myServerSocket2, theAddress); DualTransportConnector connector = new DualTransportConnector(transport, transport2); connector.connect(); context = new ProcessorContextImpl(myRouter, transport, transport2, myStorage); } return new ProcessorImpl(context, true); }