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
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
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
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
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
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
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
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
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
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
LEARN ABOUT DEBIAN
pvmfsetrbuf
SETRBUF(3PVM) PVM Version 3.4 SETRBUF(3PVM)
NAME
pvm_setrbuf - Switches the active receive buffer and saves the previous buffer.
SYNOPSIS
C int oldbuf = pvm_setrbuf( int bufid )
Fortran call pvmfsetrbuf( bufid, oldbuf )
PARAMETERS
bufid Integer specifying the message buffer identifier for the new active receive buffer.
oldbuf Integer returning the message buffer identifier for the previous active receive buffer.
DESCRIPTION
The routine pvm_setrbuf switches the active receive buffer to bufid and saves the previous active receive buffer oldbuf. If bufid is set
to 0 then the present active receive buffer is saved and no active receive buffer exists.
A successful receive automatically creates a new active receive buffer. If a previous receive has not been unpacked and needs to be saved
for later, then the previous bufid can be saved and reset later to the active buffer for unpacking.
The routine is required when managing multiple message buffers. For example switching back and forth between two buffers. One buffer
could be used to send information to a graphical interface while a second buffer could be used send data to other tasks in the application.
EXAMPLES
C:
rbuf1 = pvm_setrbuf( rbuf2 );
Fortran:
CALL PVMFSETRBUF( NEWBUF, OLDBUF )
ERRORS
These error conditions can be returned by pvm_setrbuf
PvmBadParam
giving an invalid bufid.
PvmNoSuchBuf
switching to a non-existent message buffer.
SEE ALSO
pvm_setsbuf(3PVM)
30 August, 1993 SETRBUF(3PVM)