Sometimes when I try to connect ...it takes a long time...

(seems like its slow in general)


is there a way to make it time out?
Heres the code im using...

VB Code:
  1. Private Sub FindPlayer(ByVal IP As String, ByVal Port As Integer, ByVal Player As String)
  2.         Dim WS As New UdpClient
  3.         Try
  4.             'Dim Send As String
  5.             WS.Connect(IP, Port)
  6.             Dim Status As [Byte]() = Encoding.ASCII.GetBytes("\players\")
  7.             WS.Send(Status, Status.Length)
  8.  
  9.             Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0)
  10.             Dim receiveBytes As [Byte]() = WS.Receive(RemoteIpEndPoint)
  11.             Dim returnData As String = Encoding.ASCII.GetString(receiveBytes)
  12.             TextBox4.Text = returnData.ToString()
  13.             If InStr(returnData.ToString, Player) <> 0 Then
  14.                 MsgBox("yes")
  15.             Else
  16.                 MsgBox("No")
  17.             End If
  18.             WS.Close()
  19.         Catch Ex As Exception
  20.             MsgBox(Ex.ToString())
  21.         End Try
  22.     End Sub


Thanks