예제 #1
0
 // sends a string to the socket streamwriter if connected
 public void SendMessage(string message)
 {
     try
     {
         if (_serverReconnecting && Equals(message.Split(" ")[0], TRADER_TRADE.ToString()))
         {
             // disallows trade messages being send during restart
             return;
         }
         writer.WriteLine(message);
     } catch (Exception e) { Console.WriteLine("Not connected to server"); }
 }
 public static String makeTrade(string traderID)
 {
     return($"{TRADER_TRADE.ToString()} {traderID}");
 }