Re: Issuing connect(2) after select(2) on non-blocking socket
site_archiver@lists.apple.com Delivered-To: macnetworkprog@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=3R8k/fjIat7BcelmJPzUtZoTXD21wgs0mMi60cFkGuM=; b=M9+UsgE7KVrK++q/4DZnKAfyMH+cYH8pyWEzUXjRdjlh5X2tBTFHg2N/qJSXkYTuRM BOLgWfoSiwxkR3XpWLWC4GV3On8T6ZAev1mm7VoCUqR9lh2ZyvbIq5BnZG6jBFXYr39+ NArp+kQ02z7hL3ZmP8sMffIWVeRFdQoSks/ejObL6S6a5npMKc7IAtfcf0k0JQmtb0Xc BcRJrD+EIN3ZpV7Z1uglm2N6ZE41PBV0/AKn2lEjL7XhwW3MRf9gU/xA5h9gL5lrLWPX o8FOH8RBFdHD6/fh/XfWKGymCmNYRHphf49OVMBAjWbrQqM9zdOFhwA9JCFNN20zpNT8 EzcQ== It's incorrect to call connect() twice. Try this: Call connect() on the non-blocking TCP socket and expect it to return -1 and to set errno to EINPROGRESS. Then select() the socket for writing. When select() indicates that the socket is ready for writing, check the status of the asynchronous connect() using getsockopt() with SO_ERROR. If there's nothing accepting the connection, then getsockopt() should give you ECONNREFUSED. Dado _______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (Macnetworkprog@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/macnetworkprog/site_archiver%40lists... This email sent to site_archiver@lists.apple.com
participants (1)
-
Dado Colussi