sockets

darknuke

Regular
Joined
Oct 3, 2003
Messages
68
Visual Basic:
        Dim ipaddress As Net.IPAddress
        Dim localAddr As Net.IPAddress = ipaddress.Parse("127.0.0.1")
        Dim port As Int32 = 13000
        Dim server As New TcpListener(localAddr, port)
        server.Start()
        Console.Write(">>>>>>>" & Chr(10))
        Dim tSocket As Net.Sockets.Socket = server.AcceptSocket
        Dim timeDate As String = Now()
        Console.Write("[" & timeDate & "]" & Chr(10) & " Server started (type help for more information)" & Chr(10))

The console stops as soon as I declare tSocket and doesn't do a thing. What's wrong?
 
Last edited:
I'm trying to port the console to vb, but am running into problems.

This line is causing the program to freeze:

Visual Basic:
Dim tSocket As Net.Sockets.Socket = server.AcceptSocket

If I remove it, all of the code works. If I leave it in, not even the code before it works...

Is it my system or am I making yet another n00b error?
 
Last edited:
Probably need to look at using threads to prevent blocking.
If you look in the samples that ship with .Net there is a chat program that shows the use of sockets.
 
That would help but... how come in my console app it worked fine but in a normal vb project it doesn't?
 
Last edited:
Back
Top