read system call


 
Thread Tools Search this Thread
Top Forums Programming read system call
# 1  
Old 11-16-2002
read system call

When i read 4 bytes from a socket the read function returns 0 value. what does it mean?
How should i know whether a message is available in the socket or not?
# 2  
Old 11-16-2002
>When i read 4 bytes from a socket the read function returns 0 value. what does it mean?
Read man pages on read(), the return value section. The return value of read() would be zero, stressing there were no bytes read on that stream.

>How should i know whether a message is available in the socket or not?
You could use select() or poll(), the choice is yours.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

system call

Trying to figure out a load issue with a webserver. I have traced a php script and noticed the following connect(4, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("XX.XX.XX.XX")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000035> poll(, 1, 2000) = 1 () <0.000120>... (5 Replies)
Discussion started by: rajan007
5 Replies

2. Programming

need help with system call

hi everyone i wrote a system call and compiled the kernel succesfully... my system call is in a file in the kernel folder named my_syscall1.c (kernel/my_syscall1.c) the header file for this system call i added it in the folder include like this include/my_syscall1/my_syscall1.h my problem is... (2 Replies)
Discussion started by: demis87
2 Replies

3. Programming

system call

I have a cgi script which is called after certain time interval, which has this: system ("ls -l /tmp/cgic* | grep -v \"cgicsave.env\" | awk '{print $5}'"); During the execution of this script,the output is 0 sometimes. But due to this the system call is not working at all and doesnt o/p... (2 Replies)
Discussion started by: xs2punit
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. UNIX for Advanced & Expert Users

Problem in read() system call in Xenomai-2.4

Dear All, I am having problem with read() system call in Blocking Mode. In my driver interrupt intimation done through RT FIFO. so i have created the RT FIFO and open the FIFO using open() system call with O_RDONLY flag and i am waiting for interrupt using read() blocking call.initally... (1 Reply)
Discussion started by: rajamohan
1 Replies

6. SCO

file system not getting mounted in read write mode after system power failure

After System power get failed File system is not getting mounted in read- write mode (1 Reply)
Discussion started by: gtkpmbpl
1 Replies

7. Programming

C:system call

Hi I'm studing the system call. I've written a small program that return the time spent in doing some operations. Now I'd like to write one that return the time spent in user mode of a process. I'm reading that i should use the tms struct: clock_t times(struct tms *buf); struct tms {... (2 Replies)
Discussion started by: Dedalus
2 Replies

8. Shell Programming and Scripting

system call

Hi, How to write a system calls in a script ? > cd $HOME > ls -ltr thanks in advance.. (10 Replies)
Discussion started by: hegdeshashi
10 Replies

9. Programming

c system call

How the c compiler differentiates the system calls and function calls? (1 Reply)
Discussion started by: rangaswamy
1 Replies

10. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies
Login or Register to Ask a Question