sockets

darknuke

Well-known member
Joined
Oct 3, 2003
Messages
68
Code:
        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 doesnt do a thing. Whats wrong?
 
Last edited by a moderator:
Im trying to port the console to vb, but am running into problems.

This line is causing the program to freeze:

Code:
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 by a moderator:
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 doesnt?
 
Last edited by a moderator:
Back
Top