Browse Source

指令微调

yc_t 7 years ago
parent
commit
fab6baf9ae
2 changed files with 16 additions and 2 deletions
  1. 3 1
      App.txt
  2. 13 1
      parkMonitor/server/NumMachine/ParkingSimul.cs

+ 3 - 1
App.txt

@@ -19,8 +19,10 @@
     <add key="SqlConnectionLocation" value="Data Source=127.0.0.1;port=20000;uid=root;pooling=true;max pool size=1024;pwd=yct;database=zxpark;CharSet=utf8;Allow Zero Datetime=true;" />
     <!--<add key="SqlConnectionStr" value="Data Source=59.175.148.85;port=3306;uid=root;pooling=true;max pool size=1024;pwd=x5;database=zxpark;CharSet=utf8;Allow Zero Datetime=true;" />-->
     <add key="SqlConnectionStr" value="Data Source=59.175.148.85;port=3306;uid=root;pooling=true;max pool size=1024;pwd=x5;database=zxpark;CharSet=utf8;Allow Zero Datetime=true;" />
+    <add key ="remoteDBIP" value ="59.175.148.85"/>
+    <add key ="localDBIP" value ="127.0.0.1"/>
     <!--日志写入地址配置文件-->
-    <add key="LogPath" value="c:\\c#workspace\\LogDemo\\LoggerTest" />
+    <add key="LogAddress" value="c:\\c#workspace\\LogDemo\\LoggerTest" />
     <!--测量数据误差-->
     <add key="length" value="50" />
     <add key="width" value="50" />

+ 13 - 1
parkMonitor/server/NumMachine/ParkingSimul.cs

@@ -22,7 +22,7 @@ namespace parkMonitor.server.NumMachine
         private const string userId = "18202736439";
         private const string garageId = "1";
         private const string header = "鄂A";
-        private const int licInterval = 5000;//90秒
+        private const int licInterval = 30000;//30秒
         private Random rnd;
         private Dictionary<int, CarStatusStru> numStatusMap = new Dictionary<int, CarStatusStru>();
         MessageUTF8 msgToWeb = new MessageUTF8();
@@ -65,6 +65,12 @@ namespace parkMonitor.server.NumMachine
                     client = new TcpClient();
                     client.Connect(hostname, port);
                     ns = client.GetStream();
+
+                    byte[] bytes = new byte[256];
+                    int bytesRead = ns.Read(bytes, 0, bytes.Length);
+                    MessageUTF8 temp = (MessageUTF8)JsonByByteToObjectTools.JsonByteToObj<MessageUTF8>(bytes);
+                    ns.Flush();
+
                     byte[] byteMessage = JsonByByteToObjectTools.ObjToJsonByte(msgToWeb);
                     ns.Write(byteMessage, 0, byteMessage.Length);
                     ns.Flush();
@@ -92,6 +98,12 @@ namespace parkMonitor.server.NumMachine
                 {
                     client.Connect(hostname, port);
                     ns = client.GetStream();
+
+                    byte[] bytes = new byte[256];
+                    int bytesRead = ns.Read(bytes, 0, bytes.Length);
+                    MessageUTF8 temp = (MessageUTF8)JsonByByteToObjectTools.JsonByteToObj<MessageUTF8>(bytes);
+                    ns.Flush();
+
                     byte[] byteMessage = JsonByByteToObjectTools.ObjToJsonByte(msgToWeb);
                     ns.Write(byteMessage, 0, byteMessage.Length);
                     ns.Flush();