Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, Can any one explain what is the below command doing. Code: flags = fcntl(m_sock, F_GETFL); if (fcntl(m_sock, F_SETFL, flags & (~ O_NONBLOCK) ) == -1) Whether it is trying ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2008
    Posts
    8

    fcntl


    Hi,

    Can any one explain what is the below command doing.

    Code:
     flags = fcntl(m_sock, F_GETFL);
     
    
       if (fcntl(m_sock, F_SETFL, flags & (~ O_NONBLOCK)) == -1)
    Whether it is trying for blocking or non-blocking?

    Thanks,
    Veda

  2. #2
    Linux Newbie
    Join Date
    Jun 2012
    Location
    SF Bay area
    Posts
    214
    Quote Originally Posted by vedanu View Post
    Hi,

    Can any one explain what is the below command doing.

    Code:
     flags = fcntl(m_sock, F_GETFL);
     
    
       if (fcntl(m_sock, F_SETFL, flags & (~ O_NONBLOCK)) == -1)
    Whether it is trying for blocking or non-blocking?

    Thanks,
    Veda
    I believe it's making the socket blocking. The translation of the C to something English-like would be "current flags and everything except non-blocking".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •