This should hopefully be a simple one.
I am trying to learn about the Socket.BeginAccept Method from http://msdn.microsoft.com/en-us/library/bysfec7w.aspx
When creating the AcceptReceiveCallback method, you need to call an instance of the StateObject class, but intellisense on Visual Studio doesn't recognise this and the code doesn't compile.
I am using the System reference as well as several others.
Thankyou
No, you don't need to pass a StateObject. It seems, that the example on that page is icomplete, because the StateObject is not defined. You can pass any object or even null. The BeginAccept method does not care. All it does is pass the value of that parameter to EndAccept method, where you can extract it from the AsyncState property of the asyncResult you can access from the EndAccept method.
This allows you to transport any information you might need in the EndAccept method from the BeginAccept method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With