Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9217187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:35:05+00:00 2026-06-18T02:35:05+00:00

***Background**** I am new to TCP so I have question that may be a

  • 0

***Background****
I am new to TCP so I have question that may be a bit basic. I am trying to turn on O_NONBLOCK on a socket that is receiving data. Up until now I have tried to different ways to set O_NONBLOCK, itcl() and fcntl(). Right now I am trying to get fcntl() to work.

My Question: Are you supposed to set O_NONBLOCK before you connect the socket or after?

**my current implementation of fcntl() is based off off the link before the code:

How to reset a socket back to blocking mode (after I set it to nonblocking mode)?

//set socket to NONBlocking
on = fcntl(Socket,F_GETFL);
on = (on | O_NONBLOCK);
if(fcntl(Socket,F_SETFL,on) < 0)
    {
       perror("turning NONBLOCKING on failed\n");
    }

// DO CONNECT
rc = connect()

Thank you for taking the time to look at this

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:35:06+00:00Added an answer on June 18, 2026 at 2:35 am

    You are supposed to set O_NONBLOCK whenever you want. If you do it before connect, then connect will be non-blocking as well (returning EINPROGRESS; you can select or poll for writable state to wait for its completion).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to develop an application that disables the Background Data (new feature in
Background: I'm new to Objective-C and I've never touched C before. I'm trying to
I'm trying to create a new spinner background using a 9 patch picture. I've
I'm new to PHP but come from a Java background and I'm trying to
http://lakefrontmotorlodge.co.nz/new/ I am trying to get the background to fade smoothly, but it fades
I'm relative new to C++ and my background is in Java. I have to
Trying to use TCP sockets using chrome.socket API on Chrome Version 25.0.1364.5 dev. Looking
I have a VoIP app that uses a TCP service to wake it up
I wrote an answer for this question: New background according to url , the
So i have one class which starts a new class in a new background

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.