I am reading this article. To learn about client-server communication
I do understand what is happening till this line.
AsyncCallback aCallback = new AsyncCallback(AcceptCallback);
So "aCallback" is a delegate
And there is a method AcceptCallback that is coupled that Delegate.
(intermezzo question for native englisth people, what is beter english
"a method that is" or "a method which is"
Then this delegate is passed as parameter to a method.
As far as I know delegate are a contract so all methods which want to communicate via this delegate follow the same definition structure.
Why is this delegate created here ?
Why not use the method itself ? like
Why is the second parameter, the object itself ?
For the first question, I think that it's not possible to pass a method as parameter without create a delegate before (which type of object the function BeginAccept accept as first parameter?)
For the second question, you must see the implementation of method BeginAccept of the socket class. Maybe It could reuse the sListener inside.