System.net.sockets (VB6'er - new to .Net)

C

com64

Hey all,

I'm a casual/hobby programmer who's always used VB6. I'm trying out VB 2008
express edition now. I understand a few basic concepts about .Net, but am
doing this by myself with no more help than Google.

I dont want to do anything fancy, just connect 2 machines to chat and play
chess. I used the Winsock control in VB6, and have spent the last 4 hours
or so googling to the conclusion that it's been replaced (?) with namespace
System.Net.Sockets...

Every tutorial/help file I've found online has looked as if you needed 6
months .Net experience before you could even BEGIN to understand it. I've
gotten this far, but whenever I run this code the program freezes up until
it gives a 'no response' error (not expecting a response at this point in
time). Is there any .Net equivalent to DoEvents() ?

Thanks in advance for any help/advice :0)



On Error GoTo erra

Dim hostEntry As IPHostEntry = Nothing
Dim server As String = txtIP.Text
Dim port As Integer = Int(txtPort.Text)

' Get host related information.
hostEntry = Dns.GetHostEntry(server)

' Loop through the AddressList to obtain the supported
AddressFamily. This is to avoid
' an exception that occurs when the host IP Address is not
compatible with the address family
' (typical in the IPv6 case).
Dim address As IPAddress

For Each address In hostEntry.AddressList
Dim endPoint As New IPEndPoint(address, port)
Dim sck As New Socket(endPoint.AddressFamily, SocketType.Stream,
ProtocolType.Tcp)
sck.Connect(endPoint)
Next address
erra:
errMsg(Err.Number & " - " & Err.Description)
 
M

Mr. Arnold

com64 said:
Every tutorial/help file I've found online has looked as if you needed 6
months .Net experience before you could even BEGIN to understand it. I've
gotten this far, but whenever I run this code the program freezes up until
it gives a 'no response' error (not expecting a response at this point in
time). Is there any .Net equivalent to DoEvents() ?

I don't know if it applies to your code situation.

System.Windows.Forms.Application.DoEvents()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top