pinster Posted November 18, 2002 Posted November 18, 2002 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. :) Quote Nothing is impossible in Programming! So, take it easy and let us all share your problem. :)
*Gurus* divil Posted November 18, 2002 *Gurus* Posted November 18, 2002 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. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
pinster Posted November 18, 2002 Author Posted November 18, 2002 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! :) Quote Nothing is impossible in Programming! So, take it easy and let us all share your problem. :)
Leaders quwiltw Posted November 19, 2002 Leaders Posted November 19, 2002 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? Quote --tim
mscott Posted December 12, 2002 Posted December 12, 2002 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.