public string GetMessage(Message transfer) { string message = string.Empty; if (transfer.Method == TransferMethod.REQUEST) { message = $"{Name} {transfer.Method} {(transfer as Request).Status} {transfer.DataType} {transfer.Data}"; } else { message = $"{Name} {transfer.Method} {(transfer as Response).Status} {transfer.DataType} {transfer.Data}"; } return message; }
public void Send(Message transfer) { Socket.Send(Encoding.GetBytes(GetMessage(transfer))); }