Thread: winsock - how to reject connection?

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    28

    winsock - how to reject connection?

    hi Guys,

    when i have a listening socket and a connection request comes in... is there a winsock function that i can use to reject it instead of accepting it and continue listening? (after checking the remote address)

    do i have to accept it first and close the new socket?

  2. #2
    Registered User
    Join Date
    Jan 2009
    Posts
    26
    i suppose, firstly you have to accept connection and then to close it, because you get information about the client only after accept

  3. #3
    Registered User
    Join Date
    Jan 2009
    Posts
    28
    thanks baccardi

  4. #4
    Registered User
    Join Date
    Jan 2009
    Posts
    28
    i've been experimenting with the winsock libray. and i'm still new to it so bear with me.

    just an observation...
    isn't a call to listen always followed by a call accept?
    there must be a reason they are seperate functions right?

    could someone enlighten me?

    EDIT: wait, i think i get it. it's the backlog
    Last edited by symbiote; 03-13-2009 at 10:15 AM.

  5. #5
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    you start listening on the socket once, and then you can accept as many incoming conections on this socket as you like
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Winsock issues
    By tjpanda in forum Windows Programming
    Replies: 3
    Last Post: 12-04-2008, 08:32 AM
  2. Winsock connection problem
    By Nephiroth in forum C++ Programming
    Replies: 2
    Last Post: 02-07-2006, 07:54 AM
  3. Headers that use each other
    By nickname_changed in forum C++ Programming
    Replies: 7
    Last Post: 10-03-2003, 04:25 AM
  4. Varifying Socket Connection :: Winsock
    By kuphryn in forum Windows Programming
    Replies: 3
    Last Post: 05-11-2002, 03:26 PM
  5. Listening for connection in Winsock?
    By SyntaxBubble in forum Windows Programming
    Replies: 11
    Last Post: 11-29-2001, 12:28 AM