473,473 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

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)

Jun 27 '08 #1
2 1763

"com64" <br****@orcon.net.nzwrote in message
news:63**********************************@microsof t.com...
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()

Jun 27 '08 #2

Aside from the sockets stuff, you might want to forget everything you
ever learned about On Error Goto/Resume and start using SEH
(Structured Exception Handling):
http://www.dotnetjunkies.ddj.com/Tut...5C231BF75.dcik

As for the evil DoEvents statement, this was covered in the recent
recent thread with the subject "Long Process".

Regards,

Joergen Bech

On Mon, 26 May 2008 22:05:03 +1200, "com64" <br****@orcon.net.nz>
wrote:
>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)
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bragadiru | last post by:
I installed visual studio .net on my W2k workstation. Now, whenever I'm doing a search (F3) or run a particular application, the visual studio .NET installer is launching and I have to cancel it...
1
by: Marty | last post by:
Hi, I've been askaing previously if a .NET windows control library (DLL) was handled by VB6, the answer was and is still no. But, I have a project library (an API) made in .NET, and my project...
66
by: Mitchell S. Honnert | last post by:
In some recent posts, I've seen people who seem to be waxing nostalgic with respect to the "ease of use" of Visual Basic 6. I can't quite put my finger on it, but they seem to be implying that VB6...
3
by: Allen | last post by:
I'm going to remove VB6 and VS2003 from my computer. Is there any thing there I should save. I know I haven't used any of it but I'm wondering if there are any tools, graphics, or whatever that...
1
by: HK | last post by:
I'm looking for a chart that shows the VB6 > .NET > SQL 2005 datatypes. E.g. VB6 .NET SQL2005 integer int16 smallint long int32 int byte ...
2
by: Torsten Z | last post by:
Hi, I have tried several things to passing an array of objects or a Object Collection from .NET to VB6 but I can't get it work. Passing one object works fine, but more than one not. Has anybody...
0
by: tclancey | last post by:
I have an app that connects to an Access database on a server, a decent server. My app is VB net 2003. There is another legacy app that was written in VB6, which also connects to the database....
4
by: Chris Asaipillai | last post by:
Hi there My compay has a number of Visual Basic 6 applications which are front endeed onto either SQL Server or Microsoft Access databases. Now we are in process of planning to re-write these...
8
by: Fred | last post by:
Hi People, I have a bit of a problem on my hands and wondered if anyone here has done anything similar! I have a VB6 application that displays an image stored locally (all easy stuff so far)....
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.