public ServerSocketTerminal(int port, bool emitConfigBytes = true) { server = new SocketServerProvider(emitConfigBytes); server.DataReceived += b => CallCharReceived((byte)b); server.Start(port); }
public ServerSocketTerminal(int port, bool emitConfigBytes = true) { server = new SocketServerProvider(); server.DataReceived += b => CallCharReceived((byte)b); server.ConnectionAccepted += s => { if (!emitConfigBytes) { return; } var initBytes = new byte[] { 255, 253, 000, // IAC DO BINARY 255, 251, 001, // IAC WILL ECHO 255, 251, 003, // IAC WILL SUPPRESS_GO_AHEAD 255, 252, 034, // IAC WONT LINEMODE }; s.Write(initBytes, 0, initBytes.Length); try { // we expect 9 bytes as a result of sending // config bytes for (int i = 0; i < 9; i++) { s.ReadByte(); } } catch (ObjectDisposedException) { // intentionally left blank } }; server.Start(port); }
public USBIPServer(string address, int port) { this.port = port; server = new SocketServerProvider(false); server.DataReceived += HandleIncomingData; server.ConnectionClosed += Reset; // setting initial size is just an optimization buffer = new List <byte>(Packet.CalculateLength <URBRequest>()); cancellationToken = new CancellationTokenSource(); }
public GdbStub(Machine machine, IEnumerable <ICpuSupportingGdb> cpus, int port, bool autostartEmulation, bool blockOnStep) { this.cpus = cpus; Port = port; this.blockOnStep = blockOnStep; LogsEnabled = true; pcktBuilder = new PacketBuilder(); commandsManager = new CommandsManager(machine, cpus, blockOnStep); commandsManager.ShouldAutoStart = autostartEmulation; TypeManager.Instance.AutoLoadedType += commandsManager.Register; terminal = new SocketServerProvider(false); terminal.DataReceived += OnByteWritten; terminal.ConnectionAccepted += delegate { commandsManager.CanAttachCPU = false; foreach (var cpu in commandsManager.ManagedCpus.Values) { cpu.Halted += OnHalted; cpu.ExecutionMode = blockOnStep ? ExecutionMode.SingleStepBlocking : ExecutionMode.SingleStepNonBlocking; cpu.DebuggerConnected = true; } }; terminal.ConnectionClosed += delegate { foreach (var cpu in commandsManager.ManagedCpus.Values) { cpu.Halted -= OnHalted; cpu.ExecutionMode = ExecutionMode.Continuous; cpu.DebuggerConnected = false; } commandsManager.CanAttachCPU = true; }; terminal.Start(port); commHandler = new CommunicationHandler(this, commandsManager); LogsEnabled = false; }
public ServerSocketTerminal(int port, bool emitConfigBytes = true) { server = new SocketServerProvider(emitConfigBytes); server.DataReceived += b => CallCharReceived((byte)b); server.ConnectionAccepted += s => { try { // we expect 9 bytes as a result of sending // config bytes for (int i = 0; i < 9; i++) { s.ReadByte(); } } catch (ObjectDisposedException) { // intentionally left blank } }; server.Start(port); }