//sending one message, and waiting for answer public static async Task <DRP> sr1(TCPSender tcps, string ip, DRP msg, int delay = 0) { await tcps.Connect(ip); await Task.Delay(delay); await tcps.Send(msg.ToString()); DRP res = DRP.deserializeDRP(await tcps.Receive()); return(res); }
public static async Task <DRP> sr2(TCPSender tcps, string ip, DRP msg, int delay = 0) { await tcps.Connect(ip); await Task.Delay(delay); await tcps.Send(msg.ToString()); DRP res = DRP.deserializeDRP(await tcps.Receive()); if (res.MessageType != DRPMessageType.IN_USE) { return(res); } else { return(await sr2(new TCPSender(), ip, msg, delay)); } }