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?
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
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
2. Programming
How the c compiler differentiates the system calls and function calls? (1 Reply)
Discussion started by: rangaswamy
1 Replies
3. Shell Programming and Scripting
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
4. Programming
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
5. SCO
After System power get failed
File system is not getting mounted in read- write mode (1 Reply)
Discussion started by: gtkpmbpl
1 Replies
6. UNIX for Advanced & Expert Users
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
7. UNIX for Advanced & Expert Users
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
8. Programming
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
9. Programming
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
10. Shell Programming and Scripting
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
LEARN ABOUT ULTRIX
sendmsg
send(2) System Calls Manual send(2)
Name
send, sendto, sendmsg - send a message from a socket
Syntax
#include <sys/types.h>
#include <sys/socket.h>
cc = send(s, msg, len, flags)
int cc, s;
char *msg;
int len, flags;
cc = sendto(s, msg, len, flags, to, tolen)
int cc, s;
char *msg;
int len, flags;
struct sockaddr *to;
int tolen;
cc = sendmsg(s, msg, flags)
int cc, s;
struct msghdr msg[];
int flags;
Description
The and system calls are used to transmit a message to another socket. The system call may be used only when the socket is in a connected
state, while the and system calls may be used at any time.
The address of the target is given by to, with tolen specifying its size. The length of the message is given by len. If the message is
too long to pass atomically through the underlying protocol, the error EMSGSIZE is returned, and the message is not transmitted. If the
address specified in the argument is a broadcast address, the SO_BROADCAST option must be set for broadcasting to succeed.
No indication of failure to deliver is implicit in a Return values of -1 indicate some locally detected errors.
If no messages space is available at the socket to hold the message to be transmitted, normally blocks, unless the socket has been placed
in nonblocking I/O mode. The call can be used to determine when it is possible to send more data.
The flags parameter can be set to MSG_OOB to send out-of-band data on sockets that support this features (for example, SOCK_STREAM).
See for a description of the msghdr structure.
The call returns the number of characters sent, or -1 if an error occurred.
Diagnostics
[EBADF] An invalid descriptor was specified.
[EDESTADDRREQ] A required address was omitted from an operation on a socket.
[EFAULT] An invalid user space address was specified for a parameter.
[EINVAL] An invalid argument length for the message was specified.
[EINTR] The send was interrupted by delivery of a signal.
[ENOTCONN] The socket is not connected.
[ENOTSOCK] The argument s is not a socket.
[EMSGSIZE] The socket requires that messages be sent atomically, and the size of the message to be sent made this impossible.
[EPIPE] A write on a pipe or socket for which there is no process to read the data.
[EWOULDBLOCK] The socket is marked nonblocking, and the requested operation would block.
See Also
recv(2), getsockopt(2), socket(2)
send(2)