port increments despite having been previously closed??

This is a discussion on port increments despite having been previously closed?? within the Networking/Device Communication forums, part of the General Programming Boards category; In one windows application I am developing I am periodically: opening a socket with socket() then I call connect (to ...

  1. #1
    Alessio Stella
    Join Date
    May 2008
    Location
    Italy, Bologna
    Posts
    251

    port increments despite having been previously closed??

    In one windows application I am developing I am periodically:
    opening a socket with socket()
    then I call connect (to server IP and port)
    then i exchange some data with send/recv
    then I close the socket with
    Code:
    shutdown(i, SD_BOTH)
    closesocket(i)
    appearantly all calls are performed correctly
    but what happens is that at every successive connect I am assigned a different (increasing by one) port

    Is that normal or do I have to suspect that the previous port was not set free correctly by shutdown+close?

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,668
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Comodo Firewall Vulnerability (Port 0)
    By Mario F. in forum Tech Board
    Replies: 0
    Last Post: 11-11-2009, 07:56 AM
  2. FTP program
    By jakemott in forum Linux Programming
    Replies: 14
    Last Post: 10-06-2008, 01:58 PM
  3. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  4. Segmentation Fault - Trying to access parallel port
    By tvsinesperanto in forum C Programming
    Replies: 3
    Last Post: 05-24-2006, 03:28 AM
  5. Basic port scanner code .. pls help ???
    By intruder in forum C Programming
    Replies: 18
    Last Post: 03-13-2003, 07:47 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21