Sponsored Content
Top Forums Programming How can I tell when recv is finished with pending data? Post 302634925 by Corona688 on Friday 4th of May 2012 03:10:02 AM
Old 05-04-2012
Read one character at a time into a larger buffer than you need.

Stop when you receive \n. That's when you know it's done.

Copy into the actual buffer, up to the the end of what you actually wanted. This ignores any you didn't need.
 

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
ldns(3) 						     Library Functions Manual							   ldns(3)

NAME
ldns_bget_token, ldns_bgetc, ldns_bskipcs SYNOPSIS
#include <stdint.h> #include <stdbool.h> #include <ldns/ldns.h> ssize_t ldns_bget_token(ldns_buffer *b, char *token, const char *delim, size_t limit); int ldns_bgetc(ldns_buffer *buffer); void ldns_bskipcs(ldns_buffer *buffer, const char *s); DESCRIPTION
ldns_bget_token() returns a token/char from the buffer b. This function deals with ( and ) in the buffer, and ignores when it finds them. *b: the buffer to read from *token: the token is put here *delim: chars at which the parsing should stop *limit: how much to read. If 0 the builtin maximum is used Returns s 0 on error of EOF of b. Otherwise return the length of what is read ldns_bgetc() returns the next character from a buffer. Advances the position pointer with 1. When end of buffer is reached returns EOF. This is the buffer's equivalent for getc(). *buffer: buffer to read from Returns EOF on failure otherwise return the character ldns_bskipcs() skips all of the characters in the given string in the buffer, moving the position to the first character that is not in *s. *buffer: buffer to use *s: characters to skip Returns void AUTHOR
The ldns team at NLnet Labs. Which consists out of Jelte Jansen and Miek Gieben. REPORTING BUGS
Please report bugs to ldns-team@nlnetlabs.nl or in our bugzilla at http://www.nlnetlabs.nl/bugs/index.html COPYRIGHT
Copyright (c) 2004 - 2006 NLnet Labs. Licensed under the BSD License. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. SEE ALSO
ldns_buffer. And perldoc Net::DNS, RFC1034, RFC1035, RFC4033, RFC4034 and RFC4035. REMARKS
This manpage was automaticly generated from the ldns source code by use of Doxygen and some perl. 30 May 2006 ldns(3)
All times are GMT -4. The time now is 04:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy