+ Reply to Thread
Results 1 to 2 of 2

Thread: How can I prevent other application not to bind to the same IP and port on machine?

  1. #1

    How can I prevent other application not to bind to the same IP and port on machine?

    I am using winsock to implement my TCP server.

    Now, some times it happens that some other application uses the same port!

    This brings my application into non-deterministic state.

    None of the other applications on the same machine should bind to the same port and address.

    How can I prevent such scenario?

    Please help.

  2. #2
    Junior Member
    Join Date
    Apr 2012
    Posts
    43
    There is a way in winsock that other application will not be able to reuse your address and port number on the same machine.

    You should start your application first and then user setsockopt API with SO_EXCLUSIVEADDRUSE option.


    For more information, visit this:
    http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx


+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts