private void MainForm_Load(object sender, EventArgs e) { SocketPacket reqfriendpacket = new SocketPacket(PacketType.REQFRIEND, getlocalIP(), serverip, 52052, 52054); DataTranferer.Send(serverip, 52054, reqfriendpacket); ThreadStart receivethread = new ThreadStart(ReceiveFromServer); Thread thread1 = new Thread(receivethread); thread1.IsBackground = true; thread1.Start(); }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { SocketPacket disconnect = new SocketPacket(PacketType.DISCON, getlocalIP(), serverip, 52052, 52054); DataTranferer.Send(serverip, 52052, disconnect); }