Advertisement

Problem: Client detects multiple host. But actually there's only one.

Started by October 28, 2005 12:27 PM
0 comments, last by GameDev.net 19 years, 3 months ago
(Please note that my English is not perfect as it's my 3rd language.) I'm trying to make a multi-player which can be played on LAN. I'm really new to networking so please be gentle. >_< The code is written in VB.NET ‘--------------------------------------------------------------- ‘ hostinfo class Imports System Imports Microsoft.DirectX.DirectPlay Namespace Tony_Server Public Class HostInfo Public GuidInstance As Guid ' Instance Guid for the session Public HostAddress As Address ' DirectPlay address of the session host Public SessionName As String Public Overloads Function Equals(ByVal obj As Object) As Boolean Dim node As HostInfo = CType(obj, HostInfo) Return GuidInstance.Equals(node.GuidInstance) End Function 'Equals Public Overrides Function GetHashCode() As Integer Return GuidInstance.GetHashCode() End Function 'GetHashCode Public Overrides Function ToString() As String Dim displayString As String = IIf(Not (SessionName Is Nothing), SessionName, "<unnamed>") displayString += " (" + HostAddress.GetComponentString("hostname") displayString += ":" + HostAddress.GetComponentInteger("port").ToString() + ")" Return displayString End Function 'ToString End Class End Namespace ‘-------------------------------------------------------------- ‘ This is where the problem is. App = New c_Client ‘ c_client is a client class . . . Dim host As HostInfo For Each host In App.FoundSessions ‘//lstHostFound = listbox control lstHostFound.Items.Add(host) lstHostFound.Enabled = True cmdCon.Enabled = True Next host Here, the client detects multiple hosts with the same name. How can I fix this so the client will treat these hosts(with same name) as one host? Thank you. /bow

This topic is closed to new replies.

Advertisement