Hullo,
In socket programming,i read send is similar to write, if flag is set
as 0 in send.
but I have seen one difference.
the retval is 0 in case of write and in case of send it is the number
of bytes sent (with flag zero)
Why so?
if (rval = write(msgsock, DATA, sizeof(DATA)) < 0){
printf("no. of bytes written %d\n",rval); // zero here
if((rval = send(msgsock,DATA,sizeof(DATA),0)) < 0){
printf("no. of bytes written %d\n",rval); // sizeof(DATA) here
One more question.
Is the return value indicates the number of bytes send on wire OR
number of bytes copied to kernel send buffer?
NOTE: this is for SOCK_STREAM socket in linux 2.6
Thanks.
|