I got a snippet from internet for send data through a socket .
Here is the code .
u32_t nLength = 0; u32_t nOffset = 0; do { nLength = nFullLength - nOffset; status = Socket->Send(((u8_t*) buff) + nOffset, &nLength); if (status != ERROR_SUCCESS) { break; } nOffset += nLength; } while (nOffset < nFullLength); My doubts are :
When send(sock_fd, buf+bytes, buflen-bytes, flags); function running , it will send the entire data ?
Let's assume i have a buff with 45 byte length . So it will send like
send(buf+0, 45-0) = send(buf+0, 45); So it will send complete data with length 45 ? what is the use of length here ? initially it will 45 . Isn't ?
Socket? What is the implementation ofSend()? Without those, it's impossible to be certain any answer is correct. And are you sure this is C code? It looks a lot like C++.