Thread: TCP/IP connect()

  1. #1

    TCP/IP connect()

    Can a blocking connect() return successfully if the server application has not issued an accept()? It seems once the server calls listen() this is the case. Is the inbound connection(s) then queued up by the OS waiting for the application to accept()?

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    I believe the answer to your question is 'no'. I may be off on this, but 'listen' can que up to SOMAXCON (I think that's the name), which is defined as 5, incoming connections. That is to say, it'll hold them until accept is called. I'm not an expert in this, but that is my understanding of it. As such, I doubt that 'connect' will return true there.

    Try it and find out. Write a small client and server, and never have the server 'accept'.

    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Non-blocking connect()?
    By pobri19 in forum Networking/Device Communication
    Replies: 9
    Last Post: 04-22-2009, 03:40 PM
  2. connect() function, strange error
    By Mr_Miguel in forum C Programming
    Replies: 1
    Last Post: 12-12-2006, 06:51 PM
  3. connect timeout
    By X PaYnE X in forum Networking/Device Communication
    Replies: 8
    Last Post: 05-14-2005, 09:30 PM
  4. Client timed-out once on connect(), can never connect() again
    By registering in forum Networking/Device Communication
    Replies: 6
    Last Post: 10-28-2003, 03:46 PM
  5. MySQL Connect from Outside Computer
    By juschillin in forum Windows Programming
    Replies: 0
    Last Post: 09-27-2002, 08:02 AM