12-01-2011
send() and recv() send raw bytes without any consideration for their content whatsoever. If you give it a length of 100, it will use precisely 100 bytes of that buffer given sufficient data.
Remember though: A raw byte stream might not stop at a polite boundary, isn't guaranteed to give you an entire message, and won't politely null-terminate everything for you the way things like fgets() and sprintf() do. send() and recv() are raw system calls without the niceties. You get exactly what was sent, no more, no less.
This User Gave Thanks to Corona688 For This Post:
10 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. Forum Support Area for Unregistered Users & Account Problems
I have forgotten my password and twice have entered my email address in your 'Forgotten Password' screen, but have received no email about how to proceed. Do you know what's wrong - please advise. Thanks. Jan (jvander) (0 Replies)
Discussion started by: jvandernopasswd
0 Replies
3. Programming
In attachment, is the code to test IP by ARP proxy. I always use it to test a IP already existing in my cluster.
Usage:
arp_func eth0 192.168.1.1
Enviroment:
IA64, RedHat AS3.0, 2.4.21-15.EL, gcc-3.2.3-34,
"gcc -o arp_func arp_func.c"
When the code below added before... (0 Replies)
Discussion started by: lameryang
0 Replies
4. 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
5. Programming
Hi,
Am very new to socket programming.
When we use UDP sockets to communicate between two processess,
will both the client/server socket be able to send/recv ?
meaning can sendto()/ recvfrom() be used on both server and client?
It could be useful even if anybody provide some link on socket... (1 Reply)
Discussion started by: rvan
1 Replies
6. 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
7. 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
8. 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
9. 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
10. Programming
I'm working with recv and I am having a heck of a lot of trouble ignoring excess data that I did not ask for. I was hoping someone could shine some light on the subject for me because I'm not getting anywhere fast.
---------- Post updated at 02:46 AM ---------- Previous update was at 12:31 AM... (2 Replies)
Discussion started by: Errigour
2 Replies