public TLANConnectionRepeater( int pConnectionType, String pAddress, int pPort, int pLocalPort, String pServerAddress, int pServerPort, long pUserID, String pUserPassword, long pidGeographServerObject, String pUserAccessKey, TLANConnectionExceptionHandler pExceptionHandler, TLANConnectionStartHandler pStartHandler, TLANConnectionStopHandler pStopHandler, TLANConnectionOnBytesTransmiteHandler pOnSourceBytesTransmiteHandler, TLANConnectionOnBytesTransmiteHandler pOnDestinationBytesTransmiteHandler) throws Exception { ConnectionType = pConnectionType; // . Address = pAddress; Port = pPort; // . LocalPort = pLocalPort; // . ServerAddress = pServerAddress; ServerPort = pServerPort; if (ServerPort == 0) ServerPort = GeographProxyServerDefaultPort; // . UserID = pUserID; UserPassword = pUserPassword; // . idGeographServerObject = pidGeographServerObject; // . UserAccessKey = pUserAccessKey; // . ExceptionHandler = pExceptionHandler; StartHandler = pStartHandler; StopHandler = pStopHandler; // . OnSourceBytesTransmiteHandler = pOnSourceBytesTransmiteHandler; OnDestinationBytesTransmiteHandler = pOnDestinationBytesTransmiteHandler; // . ConnectionsCount = 0; // . RepeaterServer = new TRepeaterServer(); try { while (true) { try { RepeaterServer.Start(LocalPort); break; // . > } catch (EServerPortBindingException ESPBE) { LocalPort++; if (LocalPort > MaxListeningPort) throw ESPBE; // . => } } } catch (Exception E) { Destroy(); throw E; // . => } }
public void Destroy() throws IOException, InterruptedException { if (RepeaterServer != null) { RepeaterServer.Destroy(); RepeaterServer = null; } }