Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Sockets and COBOL - problem with fcntl()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sockets and COBOL - problem with fcntl()

    I'm trying to turn off blocking for a socket by calling the fcntl() function to turn on the O_NONBLOCK flag of the F_SETFL command. Every time I run my program I get -1 returned by fcntl(). By using _errno and strerror I found out that the message is CPE3021 ("The value specified for the argument is not correct."). I'm doing a F_GETFL first and am seeing the value 4 returned by the fcntl() function but the F_SETFL doesn't work. Any ideas? 01 ChangeDescriptorAttrCmd pic s9(9) binary. 88 F_GETFL value 6. 88 F_SETFL value 7. 01 ChangeDescriptorAttrParm pic s9(9) binary. 01 O_NONBLOCK pic s9(9) binary value 128. 01 FileStatusFlag pic s9(9) binary. Set F_GETFL to TRUE. CALL PROCEDURE "fcntl" USING by value SocketDescriptor, by value ChangeDescriptorAttrCmd, GIVING ApiReturn END-CALL. Move ApiReturn to FileStatusFlag. Set F_SETFL to TRUE. Compute ChangeDescriptorAttrParm = FileStatusFlag + O_NONBLOCK. CALL PROCEDURE "fcntl" USING by value SocketDescriptor, by value ChangeDescriptorAttrCmd, by value ChangeDescriptorAttrParm GIVING ApiReturn END-CALL.
Working...
X