private void ATP_Load(object sender, EventArgs e) { DCPackage_ = new DCPackage() { PackageType = 5 }; DMIPackage_ = new DMIPackage() { PackageType = 3, ActulSpeed = 25, TrainNum = "" }; ZCPackage_ = new ZCPackage() { PackageType = 8, ReceiveID = 3, ZCID = 3 }; }
public void Start(string ip, int port) { ZCPackage_ = new ZCPackage(); Search = new SearchDistances(); hashTable = new HashTable(); localPort = port; ipLocalPoint = new IPEndPoint(IPAddress.Parse(ip), port); RemotePoint = ipLocalPoint; socket = new System.Net.Sockets.Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); try { socket.Bind(ipLocalPoint); } catch (Exception e) { MessageBox.Show(e.Message); } runningFlag = true; thread = new Thread(new ThreadStart(this.ReceiveHandle)); thread.IsBackground = true; thread.Start(); hashTable.sectionHashTable(); hashTable.switchHashTable(); }