Question TcpListener does not work in Windows Vista and I do not know why

jcl0101

Member
Joined
May 29, 2010
Messages
6
Programming Experience
Beginner
For several years I've used a little (MS) chat system (VS2005) in my local network.

It consists of a server component, which has always worked on any version prior to Windows Vista. For purposes of example, I put here for you, a snippet of code that enables communication with other machines, which runs the Clent component.

The Server Side (Name: Server01):

Imports System.Threading
Imports System.Net.Sockets
Imports System.IO
Imports System.Net
. . .
. . .

Const PORT_NUM As Integer = 16162 ‘(May be another port)
Private clients As New Hashtable()
Private listener As TcpListener
Private listenerThread As Threading.Thread
. . .
. . .

Private Sub DoListen()

Dim myHost As String = System.Net.Dns.GetHostName

Dim myIPs As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(myHost)
. . .
. . .

listener = New TcpListener(myIPs.AddressList(0), PORT_NUM)
listener.Start()
. . .
. . .

End Sub

--------------------------------------------------------------------------
The Client Side:

Imports System.Net.Sockets
Imports System.Text
. . .
. . .

Const READ_BUFFER_SIZE As Integer = 255
Const PORT_NUM As Integer = 16162
Private client As TcpClient
Private readBuffer(READ_BUFFER_SIZE) As Byte
. . .
. . .

client = New TcpClient("Server01", PORT_NUM)
client.GetStream.BeginRead(readBuffer, 0, READ_BUFFER_SIZE, AddressOf DoRead, Nothing)

. . .
. . .


----------

Everything worked perfectly as a server while having a machine with XP, and even if both components reside on the server, or if the client is located in another different machine but on the same network, including whether the client is Windows Vista.

The problem arises when trying to use Server01 component in "Windows Vista" and try to communicate from other machines. It only allows communication when both components is on that machine, ie both should reside in Windows Vista.

I tried to see if the problem is in the Vista Firewall, but accomplished nothing. It is obvious that the problem is in Windows Vista

Please, can some of this forum menber communications expert with Windows Vista (which runs in Configuring Vista), it can give me a little help, in order to clarify what I need to do in Vista?. Do I need to configure something special, or whatever, but that allows me to communicate with the Server component (Windows Vista), from any other machine on my network?

I have noticed that when I install SQL Server 2008 on Windows Vista, it does allow me to remotely access the databases through SQL Server Management Studio 2008, though I do absolutely nothing special, except for the requirements under SQL Server .

Thank you very much.:D
 
Thank you very much friend, is the correct solution. I placed what you told me, "IPAddress.Any" on the server running on Windows Vista and I could connect without problems.

Thanks a lot.

:D
 
Back
Top