本文整理汇总了C#中VirtualMachine.connect方法的典型用法代码示例。如果您正苦于以下问题:C# VirtualMachine.connect方法的具体用法?C# VirtualMachine.connect怎么用?C# VirtualMachine.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtualMachine
的用法示例。
在下文中一共展示了VirtualMachine.connect方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LaunchInternal
public static VirtualMachine LaunchInternal (ITargetProcess p, ProcessStartInfo info, Socket socket) {
Socket accepted = null;
try {
accepted = socket.Accept ();
} catch (Exception) {
throw;
}
Connection conn = new TcpConnection (accepted);
VirtualMachine vm = new VirtualMachine (p, conn);
if (info.RedirectStandardOutput)
vm.StandardOutput = p.StandardOutput;
if (info.RedirectStandardError)
vm.StandardError = p.StandardError;
conn.EventHandler = new EventHandler (vm);
vm.connect ();
return vm;
}
示例2: Connect
public static VirtualMachine Connect (Connection transport, StreamReader standardOutput, StreamReader standardError)
{
VirtualMachine vm = new VirtualMachine (null, transport);
vm.StandardOutput = standardOutput;
vm.StandardError = standardError;
transport.EventHandler = new EventHandler (vm);
vm.connect ();
return vm;
}
示例3: ListenInternal
public static VirtualMachine ListenInternal (Socket dbg_sock, Socket con_sock) {
Socket con_acc = null;
Socket dbg_acc = null;
if (con_sock != null) {
try {
con_acc = con_sock.Accept ();
} catch (Exception) {
try {
dbg_sock.Close ();
} catch {}
throw;
}
}
try {
dbg_acc = dbg_sock.Accept ();
} catch (Exception) {
if (con_sock != null) {
try {
con_sock.Close ();
con_acc.Close ();
} catch {}
}
throw;
}
if (con_sock != null) {
if (con_sock.Connected)
con_sock.Disconnect (false);
con_sock.Close ();
}
if (dbg_sock.Connected)
dbg_sock.Disconnect (false);
dbg_sock.Close ();
Connection conn = new Connection (dbg_acc);
VirtualMachine vm = new VirtualMachine (null, conn);
if (con_acc != null) {
vm.StandardOutput = new StreamReader (new NetworkStream (con_acc));
vm.StandardError = null;
}
conn.EventHandler = new EventHandler (vm);
vm.connect ();
return vm;
}
示例4: ConnectInternal
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;
}
示例5: Connect
/*
* Connect to a virtual machine listening at the specified address.
*/
public static VirtualMachine Connect (IPEndPoint endpoint) {
if (endpoint == null)
throw new ArgumentNullException ("endpoint");
Socket socket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect (endpoint);
Connection conn = new Connection (socket);
VirtualMachine vm = new VirtualMachine (null, conn);
conn.EventHandler = new EventHandler (vm);
vm.connect ();
return vm;
}