System.Net.Sockets Sample Code (VB.NET)

Client server program using System.Net.Sockets libraries.

This sample demonstrates:
  1. Duplex communication mode
  2. Usage of system.net.sockets.socket over usage of system.net.sockets.TcpClient and TCPListener.
  3. Custom connect timeout implementation.
  4. Transfer text and image (of any sizes)
Is like three times harder compared to coding in VB6. If you do not have knowledge in multi-threading,lower level data communication, CPU utilization and extensive usage of Arrays, it is hard to code system.net.sockets.socket. Just like when you are switching from VB6 to VB.NET. There are just too many things to be concerned with at one time.

This is exactly what happened to me a year ago, now I am able to share a sample code to all fellow .NET developers out there.

Honestly, it is not that easy.

The biggest deal is you need to implement your own multi-thread model when developing solution using system.net.sockets. And there is no fixed format.

However, the benefit is that you can easily switch to serial com using exactly the same architecture.

Happy coding and let's make the world a better place to live; to become less stressful, more hope and love.

Download the sample code in VB.NET(Visual Studio 2008 SP1)

Check out the VB6 equivalent.

Comments

Anonymous said…
Hi, the download link does not work