I'm using async Socket to make connections between client and server using MSDN Docs:
https://msdn.microsoft.com/en-us/library/fx6588te(v=vs.100).aspx
https://msdn.microsoft.com/en-us/library/bew39x2a(v=vs.100).aspx
I started with Synchronous and later with Asynchronous. After completed my first application successfully, I started to search in GitHub repositories with more code and more explanations. I found this:
https://github.com/perrybutler/csharpsockets
And it's okey, it work, but it has a memory leak, and I started Profiling, I found this:
(Possible memory leak)
(With Cycle Detected statments everywhere. Idk what they mean. I suppose that the application or the GC forced it to stop and marked it as a Cycle).
I think something is wrong, because if you send like 1MB of data, the memory should only increase by 1MB, but later decrease. But this is not happening. I started Disposing everything without causing an Exception, but this didn't help much.
I started searching this in StackOverflow and in other places, and I found this:
.NET Does NOT Have Reliable Asynchronouos Socket Communication?
However, I don't really understand what is being discussed there.
I also found this:
https://www.codeproject.com/Articles/83102/C-SocketAsyncEventArgs-High-Performance-Socket-Cod
I read that the Sockets needs to confirm when it already send the data between the BeginSend/EndSend & BeginReceive/EndReceive because if not, it will wait to this, and start increasing the memory (until Cycle Detected?)
Maybe with the CodeProject I shared I should get this? I don't know, where I have to start.
I need a guide for this. I will try to Profile the CodeProject.