Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Checking if a UDP port is open

Checking if a UDP port is open

Scheduled Pinned Locked Moved Visual Basic
testingbeta-testinghelpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    steve_rm
    wrote on last edited by
    #1

    Hello, VS2008 SP1 Private Function IsPortAvailable() As Boolean Using sock As New Socket(AddressFamily.InterNetwork, _ SocketType.Dgram, _ ProtocolType.Udp) sock.Connect(VaxSIPUserAgentOCX.GetMyIP(), 5060) Return sock.Connected End Using End Function Using this code I thought I had this problem solved. However, after testing I have found that the socket always connects. Even if the port is being used by another application. The port I am checking is 5060 UDP. My application when it starts will check if this is available. If another applications is using it. i.e. SJ Phone etc. The application will inform the user. However, the socket always returns true. I have checked this with netstat -aon (cmd) and I can see that the port is being used. I am checking the port on my local computer. So my IP address is 10.10.10.120. Under the netstat I can see this 0.0.0.0:5060. Why all the zeros. Could this be part of the problem Is there another method for checking this? I have looked at udp client, and wondering about winsock. Thanks,

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups