public void send(DataToSend sendingData) { if (!isConnected) { return; } string lineToSend = getSendingJson(sendingData); try { _writer.WriteLine(lineToSend); } catch (Exception ex) { Console.WriteLine(ex); isConnected = false; } //receive(); }
private string getSendingJson(DataToSend sendingData) { string json = JsonConvert.SerializeObject(sendingData); return json; }