public void OpenStream(string ip_address, int start_step, int end_step) { const int port_number = 10940; _start_step = start_step; _end_step = end_step; _urg = new TcpClient(); _urg.SendBufferSize = 0; _urg.ReceiveBufferSize = 0; _urg.Connect(ip_address, port_number); _stream = _urg.GetStream(); write(_stream, SCIP_Writer.PP()); readSpec(read_line(_stream)); write(_stream, SCIP_Writer.SCIP2()); read_line(_stream); // ignore echo back write(_stream, SCIP_Writer.MD(_start_step, _end_step)); read_line(_stream); // ignore echo back _lockobj = new object(); _read_data = new List <long>(); _distance = new long[_amax + 1]; _calib_distance = new long[_amax + 1]; // store calibration data _filtered_distance = new long[_amax + 1]; _objs = new List <Vector4>(); _isRun = true; _thread = new Thread(new ThreadStart(getDataWork)); _thread.Start(); }