title: C++ Socket - send() and connect()
body: <p>I'm new to socket programming. I'm making a client side socket in C++, and my friend is making a server side socket (also in C++), and our goal is to make a chat application together. Being new to socket programming, I was searching the internet on C++ socket and related, and I gathered enough information to make a socket and send something to another socket. The problem is with the <code>send</code> and <code>connect</code> functions. I don't really understand what parameters I should have in them, and how to initialize those. I'm hoping somebody with more experience can explain how they work, and what values to use as parameters. This is the code sample MSDN has. I hope someone helps! Regardless, thanks!</p>
  
  <pre><code>int send(
    _In_       SOCKET s,
    _In_ const char   *buf,
    _In_       int    len,
    _In_       int    flags
  );
  
  int connect(
    _In_ SOCKET                s,
    _In_ const struct sockaddr *name,
    _In_ int                   namelen
  );
  </code></pre>
  
  <p>I already know how to create a socket, so I know what goes in the first parameter; it's the socket.</p>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>These are the modules I use; I'm not sure if they are the ones I should use; I just copied them from a C++ socket example i saw online.</p>
  
  <pre><code>#include&lt;iostream&gt;    //cout
  #include&lt;stdio.h&gt; //printf
  #include&lt;string.h&gt;    //strlen
  #include&lt;string&gt;  //string
  #include&lt;sys/socket.h&gt;    //socket
  #include&lt;arpa/inet.h&gt; //inet_addr
  #include&lt;netdb.h&gt; //hostent
  </code></pre>
  
  <p>One more thing — I'm using a UDP protocol. Not sure if that will affect anything, tho!</p>