private ConfigResponse SendConfigRequest(ConfigRequest request) { if (request.RequestId == 0) { request.RequestId = _ports.NextRequestId(); } _pendingRequests.AnnounceRequest(request.RequestId); WriteMessage(request); ConfigResponse response = _pendingRequests.WaitForResponse(request.RequestId) as ConfigResponse; if (response.Result != 0) { throw new WirekiteException(String.Format("Configuration failed with code {0}", response.Result)); } return(response); }