12.07.2015 Views

z/VM: TCP/IP Programmer's Reference - z/VM - IBM

z/VM: TCP/IP Programmer's Reference - z/VM - IBM

z/VM: TCP/IP Programmer's Reference - z/VM - IBM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

fcntl()Description: The operating characteristics of sockets can be controlled with fcntl()requests. The operations to be controlled are determined by the cmd parameter. Thedata parameter is a variable with a meaning that depends on the value of the cmdparameter.The following are valid fcntl() commands:Command DescriptionF_SETFL Sets the status flags of socket s. One flag, FNDELAY, can be set.v Setting the FNDELAY flag marks s as being in nonblockingmode. If data is not present on calls that can block, such asread(), readv(), recv(), the call returns −1 and errno is set toEWOULDBLOCK.F_GETFL Gets the status flags of socket s. One flag, FNDELAY, can bequeried.v The FNDELAY flag marks s as being in nonblocking mode. Ifdata is not present on calls that can block, such as read(),readv(), recv(), the call returns with −1 and errno is set toEWOULDBLOCK.Return Values: For the F_GETFL command, the return value is the flags, set as abit mask. For the F_SETFL command, the value 0 indicates success; the value −1indicates an error. The value of errno indicates the specific error.Errno Value DescriptionEBADF Indicates that the s parameter is not a valid socket descriptor.EINVAL Indicates that the data parameter is not a valid flag.Examples:getclientid()The following are examples of the fcntl() call.int s;int rc;int flags;./* Place the socket into nonblocking mode */rc = fcntl(s, F_SETFL, FNDELAY);/* See if asynchronous notification is set */flags = fcntl(s, F_GETFL, 0);if (flags & FNDELAY)/* it is set */else/* it is not */See Also: fcntl(), ioctl(), getsockopt(), setsockopt(), socket().#include #include int getclientid(domain, clientid)int domain,struct clientid *clientid;ParameterdomainDescriptionSpecifies the address family domain and must be AF_INET.32 z/<strong>VM</strong>: <strong>TCP</strong>/<strong>IP</strong> Programmer’s <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!