Sign in to follow this  

[.net] Async Socket Flow of Data

This topic is 4479 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

I have the following line of code: mySocket.BeginReceive(buffer, 0, BufferSize, 0, new AsyncCallback(this.ReadCallback), null); The problem I have is once this is used once, it's never used again obviously and continues on. What I'm asking is what is the best way to keep recieving data even after data has been recieved? mySocket.BeginReceive(buffer, 0, BufferSize, 0, new AsyncCallback(this.ReadCallback), null); mySocket.BeginReceive(buffer, 0, BufferSize, 0, new AsyncCallback(this.ReadCallback), null); mySocket.BeginReceive(buffer, 0, BufferSize, 0, new AsyncCallback(this.ReadCallback), null); mySocket.BeginReceive(buffer, 0, BufferSize, 0, new AsyncCallback(this.ReadCallback), null); This would recieve data 4 times as you can see. Would a loop then be wise or not? If I used a loop would I have to sleep threads or DoEvents? Please discuss.

Share this post


Link to post
Share on other sites

This topic is 4479 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