title: C sendmsg() no buffer space available
body: <p>I'm not an expert in C programming, but I'm trying to write a fairly simple program using sendmsg() and recvmsg() to send a message between a client and a server (both are on the same machine, so basically I'm sending a message to localhost).</p>
  
  <p>After initialising the required structures (as in the iovec and the msghdr) and succesfully connecting the client to the server, my sendmsg() call fails with "no buffer space avaliable" errno.</p>
  
  <p>This is what linux man reports about this type of error: </p>
  
  <blockquote>
    <p>The  output queue for a network interface was full.  This generally indicates that the interface has stopped sending,  but  maybe  caused  by  transient  congestion.  (Normally, this does not occur in Linux.  Packets are just silently dropped when a device queue overflows.)</p>
  </blockquote>
  
  <p>I looked around on the Internet and as a result I found out that sendmsg() is not widely used, and nobody could relate with this type of error. The only useful advice I found was to check a possible excess of open sockets, but again I always close EVERY socket I create.</p>
  
  <p>So I'm stuck, basically because being quite the noob I don't know exactly where to look to fix this kind of problem.</p>
  
  <p>If anybody knows how to proceed, it would be great.
  (And please don't tell me not to use sendmsg(), because the whole purpose of my work is to understand this syscall, and not send a message to myself)</p>
  
  <p>Here's the code I've written so far on pastebin: <a href="http://pastebin.com/RESELfvv" rel="nofollow">client</a> and <a href="http://pastebin.com/wfGUcHvP" rel="nofollow">server</a></p>
  
  <p>--SOLVED--</p>
  
  <p>Thank you very much. I've been able to solve the problem and I fixed other mistakes I made, so here's the functioning code for sendmsg() and recvmsg() working message-passing: <a href="http://pastebin.com/nze9gznA" rel="nofollow">Client</a> and <a href="http://pastebin.com/vcmspYCY" rel="nofollow">Server</a></p>