C System Call Non Blocking Assignment


Next:6.0.3 The Sendto() call Up:6 The Socket API Previous:6.0.1 The Socket() call

6.0.2 The call

Here is the prototype of the system call:

The arguments to this call are basically the same as the standard socket call. The call reads ``one packet at a time''. It returns the length of the message written to the buffer pointed to by the argument (the second argument). Even if one packet worth of message does not ``fill up'' the buffer, will return immediately and will not read the second packet. However, if a message in a packet is too long to fit in the supplied buffer, the excess bytes are discarded.

By default, is blocking: when a process issues a that cannot be completed immediately (because there is no packet), the process is put to sleep waiting for a packet to arrive at the socket. Therefore, a call to will return immediately only if a packet is available on the socket.

When the argument of is set to , does not block if there is no data to be read, but returns immediately with a return value of 0 bytes. is defined in . In an actual UNIX system, socket descriptors are set to be non-blocking using with type , and returns errno when there is no data to be read on the non-blocking socket.



Next:6.0.3 The Sendto() call Up:6 The Socket API Previous:6.0.1 The Socket() call

Welcome to LinuxQuestions.org, a friendly and active Linux Community.

You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!

Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.

Are you new to LinuxQuestions.org? Visit the following links:
Site Howto | Site FAQ | Sitemap | Register Now

If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.

Having a problem logging in? Please visit this page to clear all LQ-related cookies.


Introduction to Linux - A Hands on Guide

This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.


Click Here to receive this Complete Guide absolutely free.

0 thoughts on “C System Call Non Blocking Assignment”

    -->

Leave a Comment

Your email address will not be published. Required fields are marked *