Visit The New, Modern Unix Linux Community

Top Forums Programming How can I tell when recv is finished with pending data? Post 302634931 by Errigour on Friday 4th of May 2012 03:13:13 AM
Test Your Knowledge in Computers #651
Difficulty: Medium
Amanda the Panda is the mascot of MOTIF.
True or False?

9 More Discussions You Might Find Interesting

1. Programming

recv() problems using AIX 4.33

I am opening a server socket on one of our machines and connection to it on the other machine. After making the connection if ether one of the systems does a recv() and ther is no data to receive then the buffer is filled with spaces and returns. I have no way of knowing if it is valid or not. ... (1 Reply)
Discussion started by: hazard0007
1 Replies

2. IP Networking

recv() not workin fine.....

hi ! In my program I have a structure as shown below: struct data { int a; char *b; long c; }str; i have assigned the following values to it: strcpy(str.b,"John"); str.a=10; str.c=123435; The client is tryin to send struct data to the server using send(sock,(char *... (2 Replies)
Discussion started by: mridula
2 Replies

3. Programming

msgrcv pending forever !!!

When I am using msgrcv to get a message from a queue, in case of msgsnd some error, the msgrcv thread will waiting forever. Is there some way that I can specify a time out value for this queue ? just let msgrcv wait for some time, if no message comes during this time slot, msgrcv just return... (3 Replies)
Discussion started by: Yun Gang Chen
3 Replies

4. Programming

C Network Programming - recv() help

So I'm making a program that gets the IP Address of an inputed website, then sends the IP Address to an inputed host. This program has no real meaning, but just a learning experiment. So I sucessfully made the program, then I wanted to try out recv(), and it produces some weird output; here is the... (2 Replies)
Discussion started by: Octal
2 Replies

5. Programming

recv syscall for socket programming

I have a question regarding the recv syscall. Suppose I have a client/server and the following exchange of message took place: Client --> Server using multiple send syscalls one after another immediately: send "Packet1" send "Packet2" send "Packet3" Server receives in the... (2 Replies)
Discussion started by: heljy
2 Replies

6. Programming

ABOUT RECV() SYSTEM CALL (regarding timer)

Hi all, I am facing a problem in recv() system call i.e.. in my project i have to implement timer for sending (data) and resending purpose when there is no acknowledgement. is there any way that recv() sys call has its own timer i.e., for ex: recv() has to wait for 10 secs. if any... (0 Replies)
Discussion started by: Rohil
0 Replies

7. Programming

Recv() call with timer(time out )

Hi all, I am facing a problem in recv() system call i.e.. in my project i have to implement timer for sending (data) and resending purpose when there is no acknowledgement. is there any way that recv() sys call has its own timer i.e., for ex: recv() has to wait for 10 secs. if any one knows... (2 Replies)
Discussion started by: Rohil
2 Replies

8. UNIX for Dummies Questions & Answers

pending signals

I was wondering about following. If I have set of 3 signals. And they are all blocked.Now at some point in the program the set is unblocked. Which signal will be delivered first.This is my set....SIGTSTP,SIGQUIT,SIGINT.When I added them in the set and unblock them I did it in following order... ... (1 Reply)
Discussion started by: joker40
1 Replies

9. IP Networking

regarding recv function

hi, the syntax of recv function is: int recv( int sockfd, void *buffer, int length, unsigned int flags); Suppose i declared a buffer of size 100 ,then length to be specified in recv function is sizeof(buffer) or sizeof(buffer)-1 ( i.e 100 or 99) thanks in advance (2 Replies)
Discussion started by: kavitha rao
2 Replies
recv(2) 							System Calls Manual							   recv(2)

recv - Receives messages from connected sockets SYNOPSIS
#include <sys/socket.h> ssize_t recv ( int socket, void *buffer, size_t length, int flags ); [Tru64 UNIX] The following definition of the recv() function does not conform to current standards and is supported only for backward com- patibility (see standards(5)): #include <sys/socket.h> int recv ( int socket, char *buffer, int length, int flags ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: recv(): XNS5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the socket descriptor. Points to a buffer where the message should be placed. Specifies the size of the buffer pointed to by the buffer parameter. Points to a value controlling the message reception. The flags parameter is formed by logically ORing one or more of the following values, defined in the sys/socket.h file: Peek at incoming message. The data is treated as unread and the next recv() function (or similar function) will still return this data. Process out-of-band data. Requests that the function block wait until the full amount of data requested can be returned. The function may return a smaller amount of data if a signal is caught, the connection is terminated, or an error is pending for the socket. DESCRIPTION
The recv() function receives messages from a connected socket. The recvfrom() and recvmsg() functions receive messages from both connected and unconnected sockets; however, they are usually used for unconnected sockets only. The recv() function returns the length of the message. If a message is too long to fit in the supplied buffer, excess bytes may be trun- cated depending on the type of socket that issued the message. If no messages are available at the socket, the recv() function waits for a message to arrive, unless the socket is nonblocking. If a socket is nonblocking, errno is set to [EWOULDBLOCK]. Use the select() function to determine when more data arrives. NOTES
[Tru64 UNIX] The recv() function is identical to the recvfrom() function with a zero-valued address_len parameter, and to the read() func- tion if no flags are used. For that reason the recv() function is disabled when 4.4BSD behavior is enabled; that is, when the _SOCK- ADDR_LEN compile-time option is defined. RETURN VALUES
Upon successful completion, the recv() function returns the length of the message in bytes. If no messages are available and the peer has closed the connection, the recv() function returns a value of 0. Otherwise, the function returns a value of -1 and sets errno to indicate the error. ERRORS
If the recv() function fails, errno may be set to one of the following values: The socket parameter is not valid. A connection was forcibly closed by a peer. The data was directed to be received into a nonexistent or protected part of the process address space. The buffer parameter is invalid. A signal interrupted the recv() function before any data was available. The MSG_OOB flag is set and no out- of-band data is available. An I/O error occurred while reading from or writing to the file system. Insufficient resources were available in the system to complete the call. The system did not have sufficient memory to fulfill the request. The available STREAMS resources were insufficient for the operation to complete. Receive is attempted on a connection-oriented socket that is not connected. The socket parameter refers to a file, not a socket. The specified flags are not supported for this socket type or protocol. The connection timed out during connection establishment or due to a transmission timeout on active connection. The socket is marked nonblocking, and no data is waiting to be received. RELATED INFORMATION
Functions: recvfrom(2), recvmsg(2), send(2), sendmsg(2), sendto(2), select(2), shutdown(2), socket(2), read(2), write(2) Standards: standards(5) delim off recv(2)

Featured Tech Videos

All times are GMT -4. The time now is 09:49 PM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy