Visit The New, Modern Unix Linux Community

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
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.
Test Your Knowledge in Computers #81
Difficulty: Easy
AT&T UNIX, SCO UnixWare, Sun Microsystems Solaris, HP-UX, IBM AIX, SGI IRIX and many big corporations who wanted license and profit from their own versions of Unix are not as common today as they were in the 1980s.
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
XmTextFieldGetSubstringWcs(3X)											    XmTextFieldGetSubstringWcs(3X)

XmTextFieldGetSubstringWcs - A TextField function that retrieves a portion of a wide character internal text buffer SYNOPSIS
#include <Xm/TextF.h> int XmTextFieldGetSubstringWcs (widget, start, num_chars, buffer_size, buffer) Widget widget; XmTextPosition start; int num_chars; int buffer_size; wchar_t *buffer; DESCRIPTION
XmTextFieldGetSubstringWcs retrieves a copy of a portion of the internal text buffer of a TextField widget that is stored in a wide charac- ter format. The function copies a specified number of characters from a given start position in the internal text buffer into a buffer provided by the application. A NULL terminator is placed at the end of the copied data. Specifies the TextField widget ID. Specifies the beginning character position from which the data will be retrieved. This is an integer number of characters from the beginning of the text buffer. The first character position is 0. Specifies the number of wchar_t characters to be copied into the provided buffer. Specifies the size of the supplied buffer as a number of wchar_t storage locations. The minimum size is num_chars + 1. Specifies the wide character buffer into which the internal text buffer will be copied. For a complete definition of TextField and its associated resources, see XmTextField(3X). RETURN VALUE
The function was successful. The function failed because it was unable to copy the specified number of characters into the buffer pro- vided. The buffer size may be insufficient. The contents of buffer are undefined. The requested number of characters extended beyond the internal buffer. The function copied characters to the end of the buffer and terminated the string with a NULL terminator; fewer than num_chars characters were copied. SEE ALSO
XmTextField(3X), XmTextFieldGetSubstring(3X) XmTextFieldGetSubstringWcs(3X)

Featured Tech Videos

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