|
-
Sep 15th, 2007, 10:37 PM
#1
Thread Starter
New Member
System.Net.Sockets Help
I need some help with System.Net.Sockets.
I'm trying to convert this code that was written in Visual Basic 6.0 to Visual Basic Express.
Here is the old code:
Code:
frmMain.Winsock.Send "Reg" & txtUsername & ":" & txtPassword & ":" & txtEmailAddress & vbFormFeed
What would be the equivalent of the same code using System.Net.Sockets in Visual Basic Express. I have already setup a connection and everything.
-
Sep 16th, 2007, 05:46 AM
#2
Re: System.Net.Sockets Help
There's a .NET based Winsock available here that you may want to look into:
http://www.codeproject.com/vb/net/winsockdotnet.asp
I haven't had much time to do anything with it yet, but it SHOULD be basically equivilant to the Winsock used in VB6, but with some other added functionality thanks to the .NET framework.
-
Sep 16th, 2007, 05:52 AM
#3
Re: System.Net.Sockets Help
To send data, you need to write to the networkstream.
Heres an example
VB Code:
'SomeClient is a System.Net.Sockets.TcpClient class
Try
Using sw As New IO.StreamWriter(SomeClient.GetStream)
sw.Write("Hey")
End Using
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
-
Sep 20th, 2007, 02:50 AM
#4
Member
Re: System.Net.Sockets Help
 Originally Posted by Campion
There's a .NET based Winsock available here that you may want to look into:
http://www.codeproject.com/vb/net/winsockdotnet.asp
I haven't had much time to do anything with it yet, but it SHOULD be basically equivilant to the Winsock used in VB6, but with some other added functionality thanks to the .NET framework.
Great answer thanks dude you helped me out and stopped me threading )
-
Sep 20th, 2007, 04:14 AM
#5
Re: System.Net.Sockets Help
 Originally Posted by r1chyb
Great answer thanks dude you helped me out and stopped me threading  )
But why would you want to use that? If the answer is "Because then the code is already written for me", then one could ask why you are programming in the first place. You will have to package extra stuff along with your project and make it more bulky and you will never learn the techniques of socket programming which is very good to know. The .Net framework already provides us with a great number of classes to do whatever we want, why download extra classes?
This Winsock.Net control is apparently made by a VB6 programmer that misses the winsock control in .Net. An attempt to make .Net more like VB6..bah.
-
Sep 20th, 2007, 06:38 AM
#6
Re: System.Net.Sockets Help
 Originally Posted by Atheist
This Winsock.Net control is apparently made by a VB6 programmer that misses the winsock control in .Net. An attempt to make .Net more like VB6..bah.
You may have a point there, but when you download and look at the source code, it's a great way to figure out how it's done in .NET.
I'm trying to learn it the .NET way as well based on the threads I've found on this site, but so far, it's proving to be way too confusing and headache inducing, and ends up resulting in massive failure.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|