Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

io_canread(3) [debian man page]

io_canread(3)						     Library Functions Manual						     io_canread(3)

NAME
io_canread - return a file descriptor that can be read from SYNTAX
#include <io.h> int64 io_canread(); DESCRIPTION
io_canread returns the next file descriptor that can be read from. You have to have used io_wantread() on the file descriptor earlier, and you have to have called io_wait() or io_waituntil(). These functions then keep an internal data structure on which descriptors were reported readable by the operating system. Please note that there is no guarantee that there still is data that can be read from the descriptor, just that there was data when io_wait() or io_waituntil() were called. Another process could have read the data before you. Look at the result from io_tryread(). If there are no more descriptors that you can write to without blocking, io_canwrite will return -1. In this case you should call io_wait() or io_waituntil() again. You should use io_tryread(3) to read from the descriptor, not plain read(2). If you use read(2) and you get EAGAIN, call io_eagain(3). SEE ALSO
io_wait(3), io_canwrite(3), io_eagain(3) io_canread(3)

Check Out this Related Man Page

iob_send(3)						     Library Functions Manual						       iob_send(3)

NAME
iob_send - send I/O batch SYNTAX
#include <iob.h> int64 iob_send(int64 s,io_batch* b); DESCRIPTION
iob_send sends the (rest of) b over the socket s. iob_send returns the number of bytes written, 0 if there were no more bytes to be written in the batch, -1 for EAGAIN, or -3 for a perma- nent error (for example "connection reset by peer"). The normal usage pattern is using io_wait to know when a descriptor is writable, and then calling iob_send until it returns 0, -1 or -3. If it returns 0, terminate the loop (everything was written OK). If it returns -1, call io_wait again. If it returned -3, signal an error and close the socket. The benefit of the I/O batch API is that it exploits platform specific APIs like FreeBSD's sendfile. The file contents will always be sent in a way that allows the operating systems to perform zero copy TCP, and the buffers will always be sent using as few syscalls as possible and avoiding unnecessary copying (using writev). SEE ALSO
iob_reset(3), iob_send(3), iob_addbuf(3), iob_adds_free(3), iob_addfile(3), iob_prefetch(3) iob_send(3)
Man Page

5 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing a file descriptor

I am trying to right a function which uses a file descriptor to write to a log file. The problem is that the on the print statement the file descriptor is called bad. Now when I first open the file and print to it in the f_open function by passing the descriptor to f_print_log all works well,... (6 Replies)
Discussion started by: robotball
6 Replies

2. UNIX for Dummies Questions & Answers

Write/read to file descriptors

Is it possible to write to file descriptor 0 and read from 1 or 2? How could this be implemented? (3 Replies)
Discussion started by: machshev
3 Replies

3. Programming

How to use we use int64?

Recently my project needs int64 variables. However my os and computer are both 32bits. So how can i use int64 as a parameter in a function. and is int64 a structure as user-defined structures..... ??? thanx i am waiting for ur answer:rolleyes: (2 Replies)
Discussion started by: macroideal
2 Replies

4. UNIX for Advanced & Expert Users

read system call reading the same data

Hi, I wrote a program, to read from a master terminal. However, the 'read' system call keeps returning the same data endlessly (I expected it to read once and then block). What will cause t data to be flushed, after 1 read? #include <stdio.h> #include <string.h> #include <sys/types.h>... (1 Reply)
Discussion started by: karthikb23
1 Replies

5. Shell Programming and Scripting

file descriptor KSH

Hello, How can i use file descriptor in a script to read 2 files at the same time and extract line 200 from file 1 and line 500 from file 2. Thanks. (6 Replies)
Discussion started by: LiorAmitai
6 Replies