Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I know Inet Control and Winsock Control are both included in Socket Class. However, it would be great if someone who have the experience and knowledge in VB.NET to show us how to use Socket Class to achieve some if not all the functionality in Inet & Winsock through a comprehensive tutorial.

 

Eg. Inet.OpenURL is for downloading, Winsock.SendData is to send something and etc... but how it works in .NET socket class?

 

Besides, 1 thing I experience in Socket Class is that after I had downloaded a file, I must actually perform encoding to get the ASCII contents because everything downloaded is byte stream (I think...)... so, this is a highlight to inform others too..

 

Thanks for considering my suggestion. :)

Nothing is impossible in Programming! So, take it easy and let us all share your problem. :)
  • *Gurus*
Posted

The socket class is a very powerful component meant to replace the functionality of the Winsock control from VB6. I will be posting either a tutorial on it or some sample code in the near future.

 

As for the inet control, the socket class does not offer such a high-level approach to downloading data. This short snippet (courtesy of Derek I think) illustrates how easy it is to download data from HTTP synchronously in .NET:

 

Dim wcDownload As New System.Net.WebClient()
Dim bytDatabuffer As Byte() = wcDownload.DownloadData("http://www.microsoft.com/")
Dim strDatabuffer As String = System.Text.Encoding.ASCII.GetString(bytDatabuffer)

 

Having to manually encode/decode text took a bit of getting used to, but it's good for platform independance, and it eliminates the need to use strings some of the time. Take sending a binary file by FTP for example - you use a BinaryReader to get a byte array from a file, and you can pass that byte array right to a Socket class to send it. No need for cumbersome strings where they're not necessary.

MVP, Visual Developer - .NET

 

Now you see why evil will always triumph - because good is dumb.

 

My free .NET Windows Forms Controls and Articles

Posted
That's great! :) Hope to see the tutorial soon! I think a P2P chat program would be a good example to show how Socket Class is in action! :)
Nothing is impossible in Programming! So, take it easy and let us all share your problem. :)
  • Leaders
Posted

There's a good sample project on this included in Visual Studio.NET. Have you taken a look at

C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\Applications\Wintalk\vb

this project?

--tim
  • 4 weeks later...
Posted

Tutorials

 

I've played w/ the the chat program that comes w/ .NET. I think, if divil were to demonstate the sockets class by creating a p2p chat program, he'd do a more extensive job than microsoft did.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...