Sign in to follow this  

.NET framework 2.0 BeginReceive() information?

This topic is 4310 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone have any code examples for the .NET framework 2.0's BeginReceive function? All the info I can dig up on async networking utilizes the old BeginReceive function from .NET 1.1. I've found the MSDN page for the new version of the function, but it doesn't have code examples - and not only that, but it seems to be faulty as well in the information it provides (seeing as my MSVC 2005 Express compiler is complaining about the first buffer parameter which I've declared as an array of Byte (not byte), which, according to MSDN, should be correct). The MSDN page is located here.

Share this post


Link to post
Share on other sites
this is how i use it:


DataPacket packet = new DataPacket();
packet.ClientSocket = m_Connections[i];
packet.DataArray = new byte[m_Connections[i].Available];
AsyncCallback callback = new AsyncCallback(ReceiveEnded);
m_Connections[i].BeginReceive(packet.DataArray, 0, m_Connections[i].Available, SocketFlags.None, callback, packet);

Share this post


Link to post
Share on other sites

This topic is 4310 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this