| | |
| | | |
| | | public class TcpServer |
| | | { |
| | | public static Dictionary<string,string> TrayIps = new Dictionary<string,string>(); |
| | | public static Dictionary<string, string> TrayIps = new Dictionary<string, string>(); |
| | | public TcpServer(string ip) |
| | | { |
| | | Init(ip); |
| | |
| | | //} |
| | | //else |
| | | //{ |
| | | Console.WriteLine($"ãTCPä¿¡æ¯åè®®å¼å¸¸ {DateTime.Now.Millisecond}ãï¼IPï¼{remote_ip},MSGï¼{message}"); |
| | | Console.WriteLine($"ãTCPä¿¡æ¯åè®® {DateTime.Now.Millisecond}ãï¼IPï¼{remote_ip},MSGï¼{message}"); |
| | | var mg = Encoding.ASCII.GetString(PlcHelper.Hex2Bin(message)); |
| | | Console.WriteLine(mg); |
| | | if (mg.StartsWith("DK") && mg.Trim().Length == "DK01000024".Length) |
| | | { |
| | | if(TrayIps.TryGetValue(remote_ip,out string traycode)) |
| | | LogHelper.Info($"æ«ç å¨ >{remote_ip} -{mg}"); |
| | | if (TrayIps.TryGetValue(remote_ip, out string traycode)) |
| | | { |
| | | TrayIps[remote_ip] = traycode; |
| | | }else TrayIps.Add(remote_ip, traycode); |
| | | } |
| | | else TrayIps.Add(remote_ip, traycode); |
| | | |
| | | Console.WriteLine("TOFF"); |
| | | var mst = PlcHelper.Hex2Bin("544F4646"); |
| | | TcpServer.TcpServerSend(remote_ip, mst); |