❔ Memory leak leading to overflow crash if server doesn't gracefully close socket with my client app
if my client app has a socket open with server, and server stops working/closes my client app gets a runaway memory leak that causes overflow. Typically when the server closes the socket what happens to the client? Should I poll the socket connection to make sure it's open and if closed, stop the socket thread (background = true)? Trying to figure out how to go abut fixing the memory leak.
this is how I open the socket in my winform client
8 Replies
These are my socket connect and disconnect methods https://pastebin.com/p5QK2fx1
Pastebin
public void ConnectToGSP() { IPAddress iPAddress = IPAdd...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Take a snapshot in diagnostics
it's caused by the receive method
Call BeginReceive in the callback of BeginRecieve.
And skip the while loop.
https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.beginreceive read example.
As BeginReceive is not blocking.
If you want blocking, use Recieve
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.