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. C#
  4. Check Internet Port Status ?

Check Internet Port Status ?

Scheduled Pinned Locked Moved C#
tutorialsysadminquestion
3 Posts 3 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.
  • A Offline
    A Offline
    Ariston Darmayuda
    wrote on last edited by
    #1

    I want to know how to check the internet port status, becuse i want to create a TCP server application that can select the port dynamic, you know not static. For example i want to check port 1313 from ip 127.0.0.1, i want to know status (is it opened or not), if opened i want to know who is open the port. Like port scanner you know, but this for socket application. Thank's for your comments.

    B L 2 Replies Last reply
    0
    • A Ariston Darmayuda

      I want to know how to check the internet port status, becuse i want to create a TCP server application that can select the port dynamic, you know not static. For example i want to check port 1313 from ip 127.0.0.1, i want to know status (is it opened or not), if opened i want to know who is open the port. Like port scanner you know, but this for socket application. Thank's for your comments.

      B Offline
      B Offline
      Bojan Rajkovic
      wrote on last edited by
      #2

      The only thing I can think of is that you try to programatically open ports in a while loop which has a try-catch inside to try to open the socket, and catch the exception and continue the loop...You can also figure out which specific exception will fire when the port is in use and only catch that one, but let other exceptions be thrown or just catch-all and assume that it's an already open-port.

      1 Reply Last reply
      0
      • A Ariston Darmayuda

        I want to know how to check the internet port status, becuse i want to create a TCP server application that can select the port dynamic, you know not static. For example i want to check port 1313 from ip 127.0.0.1, i want to know status (is it opened or not), if opened i want to know who is open the port. Like port scanner you know, but this for socket application. Thank's for your comments.

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        I think you can use Socket.Poll for single ports and Socket.Select for multiple ports. That wont tell you who own the port though. xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots

        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