string[] ReceiveOutputLines(int timeout) { var output = new List <string>(); stream.ReadTimeout = timeout; while (true) { string InputString = DebuggerOutput.ReadLine(); if (InputString == null) { return(null); } output.Add(InputString); if (InputString == "(gdb)") { break; } } return(output.ToArray()); }
public override void Close() { DebuggerInput.Close(); DebuggerOutput.Close(); stream.Close(); client.Close(); }
private void ReaderThread() { while (true) { GetInput.WaitOne(); InputString = DebuggerOutput.ReadLine(); GotInput.Set(); } }
string ReadData() { string header = ""; while (true) { // Read until "\r\n\r\n" int res = DebuggerOutput.Read(); if (res < 0) { return(null); } header += (char)res; if (header.Length < TWO_CRLF.Length) { continue; } if (header.Substring(header.Length - TWO_CRLF.Length, TWO_CRLF.Length) != TWO_CRLF) { continue; } // Extract Content-Length int lengthIndex = header.IndexOf(CONTENT_LENGTH); if (lengthIndex == -1) { continue; } int contentLength = Int32.Parse(header.Substring(lengthIndex + CONTENT_LENGTH.Length)); char[] buffer = new char[contentLength + 1]; buffer[contentLength] = '\0'; int buffer_i = 0; while (buffer_i < contentLength) { int count = 0; try { count = DebuggerOutput.Read(buffer, buffer_i, contentLength - buffer_i); } catch (IOException) { return(null); } buffer_i += count; } return(new string(buffer)); } // unreachable }
string ReadData() { string header = ""; while (true) { // Read until "\r\n\r\n" int res = DebuggerOutput.Read(); if (res < 0) { return(null); } header += (char)res; if (header.Length < TWO_CRLF.Length) { continue; } if (header.Substring(header.Length - TWO_CRLF.Length, TWO_CRLF.Length) != TWO_CRLF) { continue; } // Extract Content-Length int lengthIndex = header.IndexOf(CONTENT_LENGTH); if (lengthIndex == -1) { continue; } int contentLength = Int32.Parse(header.Substring(lengthIndex + CONTENT_LENGTH.Length)); char[] result = new char[contentLength]; if (DebuggerOutput.Read(result, 0, contentLength) == -1) { return(null); } return(new string(result)); } // unreachable }
public override void Close() { DebuggerInput.Close(); DebuggerOutput.Close(); }