I am trying to make a client-server application using some person's code for console as an example. In the Main function he uses this
Task.Run(() => { while (true) ReceivePacket(); });
for receiving packets. He sends a packet from one client and receives it with this on another. ReceivePacket is a custom function that does some things when a packet is received.
I am using WinForms and I need to catch all sent packets somehow. What if I put this line in the constructor of my main form? Will it work then? Or should I place it somewhere else?
My app is not finished yet so I can't just launch and check.