Mono.Debugger.Soft.VirtualMachineManager.ConnectInternal C# (CSharp) Method

ConnectInternal() public static method

public static ConnectInternal ( Socket dbg_sock, Socket con_sock, IPEndPoint dbg_ep, IPEndPoint con_ep ) : VirtualMachine
dbg_sock Socket
con_sock Socket
dbg_ep System.Net.IPEndPoint
con_ep System.Net.IPEndPoint
return VirtualMachine
		public static VirtualMachine ConnectInternal (Socket dbg_sock, Socket con_sock, IPEndPoint dbg_ep, IPEndPoint con_ep) {
			if (con_sock != null) {
				try {
					con_sock.Connect (con_ep);
				} catch (Exception) {
					try {
						dbg_sock.Close ();
					} catch {}
					throw;
				}
			}
						
			try {
				dbg_sock.Connect (dbg_ep);
			} catch (Exception) {
				if (con_sock != null) {
					try {
						con_sock.Close ();
					} catch {}
				}
				throw;
			}

			Connection conn = new Connection (dbg_sock);

			VirtualMachine vm = new VirtualMachine (null, conn);

			if (con_sock != null) {
				vm.StandardOutput = new StreamReader (new NetworkStream (con_sock));
				vm.StandardError = null;
			}

			conn.EventHandler = new EventHandler (vm);

			vm.connect ();

			return vm;
		}