title: How exactly does fopen(), fclose() work?
body: <p>I was just wondering about the functions fopen, fclose, socket and closesocket. When calling fopen or opening a socket, what exactly is happening (especially memory wise)? </p>
  
  <p>Can opening files/sockets without closing them cause memory leaks? </p>
  
  <p>And third, how are sockets created and what do they look like memory wise? </p>
  
  <p>I'm also interrested in the role of the operating system (Windows) in reading the sockets and sending the data. </p>