Jump to content
  • Advertisement
Sign in to follow this  
ed209

[.net] Registering Winsock control

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

Hi, I was wondering if someone could tell me how to register the winsock control in vb.net? I have this code I'd like to run, but I can't because I haven't registered the control yet. Please help.

Share this post


Link to post
Share on other sites
Advertisement
Well I tried using System.net.sockets but I keep getting this cross threading error whenever I try to write the text to my chat window/textbox.


Cross-thread operation not valid: Control 'txtChat' accessed from a thread other than the thread it was created on.

Is there anyways around this???

[Edited by - ed209 on July 15, 2008 1:12:55 AM]

Share this post


Link to post
Share on other sites
Ah, I just disabled CheckForIllegalCrossThreadCalls.

Hope it doesn't cause any problems.

Share this post


Link to post
Share on other sites
Quote:
Original post by ed209
Hope it doesn't cause any problems.
As the article states:
Quote:
Access to Windows Forms controls is not inherently thread safe. If you have two or more threads manipulating the state of a control, it is possible to force the control into an inconsistent state. Other thread-related bugs are possible as well, including race conditions and deadlocks. It is important to ensure that access to your controls is done in a thread-safe way.
.NET helps you out here by throwing an exception as soon as you try and access a control from a different thread to the one it was created on - consistent, avoidable failure (even if nothing appears to be wrong) is better than erratic and difficult-to-replicate bugs. You should write thread-safe code rather than rely on the workaround.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!