/// <summary> Starts waiting in a separate thread for connections to the given /// ServerSocket from the given IP address. /// </summary> /// <param name="theServer"> /// </param> /// <param name="theAddress">IP address from which to accept connections (null /// means any) /// </param> public Acceptor(System.Net.Sockets.TcpListener theServer, System.String theAddress) { Acceptor a = this; IThreadRunnable r = new AnonymousClassRunnable(a, theServer, theAddress, this); SupportClass.ThreadClass thd = new SupportClass.ThreadClass(new System.Threading.ThreadStart(r.Run)); thd.Start(); }
/// <summary> Starts accepting connections in a new Thread. Note that this can be /// called multiple times with separate addresses. The stop() method ends /// all Threads started here. /// /// </summary> /// <param name="theAddress">IP address from which connections are accepted (null /// means any address is OK) /// </param> public virtual void start(System.String theAddress) { NuGenHL7Server server = this; IThreadRunnable acceptor = new AnonymousClassRunnable(server, theAddress, this); myIsRunning = true; SupportClass.ThreadClass thd = new SupportClass.ThreadClass(new System.Threading.ThreadStart(acceptor.Run)); thd.Start(); }
/// <summary>Sends in a new thread if isThreaded, otherwise in current thread </summary> private void sendAppResponse(NuGenTransportable theResponse) { NuGenProcessorImpl processor = this; IThreadRunnable sender = new AnonymousClassRunnable(processor, theResponse, this); if (myThreaded) { SupportClass.ThreadClass thd = new SupportClass.ThreadClass(new System.Threading.ThreadStart(sender.Run)); thd.Start(); } else { sender.Run(); } }
/// <summary> Destroys all objects related to the connection /// including the process that was tied to this /// session via SessionManager.launch(), if it /// exists. /// </summary> public virtual void terminate() { bool playerWillTerminateItself = false; // unbind first try { // Tell player to end session. Note that this is just a hint, and will often // do nothing. For example, the Flash player running in a browser will // currently never terminate when you tell it to, but the AIR player will // terminate. playerWillTerminateItself = unbind(true); } catch (Exception) { } if (!playerWillTerminateItself) { #if false //UPGRADE_TODO: Method 'java.lang.System.getProperty' was converted to 'System.Environment.GetEnvironmentVariable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangSystemgetProperty_javalangString'" if (Environment.GetEnvironmentVariable("OS").ToLower().StartsWith("mac os x")) //$NON-NLS-1$ //$NON-NLS-2$ { // In certain situations, AppleScript can hang for about two minutes (bug 193086). Since all we're // trying to do here is close the browser window, we do the work in a separate thread. If that // thread hangs for two minutes, no harm done. IThreadRunnable r = new AnonymousClassRunnable(this); new SupportClass.ThreadClass(new System.Threading.ThreadStart(r.Run), "Terminate Mac debug target").Start(); //$NON-NLS-1$ } #endif // if we have a process pop it if (m_process != null) { try { m_process.Kill(); } catch (Exception) { } } } // now clear it all m_protocol = null; m_socket = null; m_manager = null; m_process = null; m_isConnected = false; m_isHalted = false; }