public void Connect () {
byte[] buf = new byte [HANDSHAKE_STRING.Length];
char[] cbuf = new char [buf.Length];
// FIXME: Add a timeout
int n = Receive (buf, 0, buf.Length);
if (n == 0)
throw new IOException ("DWP Handshake failed.");
for (int i = 0; i < buf.Length; ++i)
cbuf [i] = (char)buf [i];
if (new String (cbuf) != HANDSHAKE_STRING)
throw new IOException ("DWP Handshake failed.");
socket.Send (buf);
receiver_thread = new Thread (new ThreadStart (receiver_thread_main));
receiver_thread.Start ();
Version = VM_GetVersion ();
//
// Tell the debuggee our protocol version, so newer debuggees can work
// with older clients
//
//
// Older debuggees might not support this request
EventHandler<ErrorHandlerEventArgs> OrigErrorHandler = ErrorHandler;
ErrorHandler = null;
ErrorHandler += delegate (object sender, ErrorHandlerEventArgs args) {
throw new NotSupportedException ();
};
try {
VM_SetProtocolVersion (MAJOR_VERSION, MINOR_VERSION);
} catch (NotSupportedException) {
}
ErrorHandler = OrigErrorHandler;
}