title: (How) Can I find the socket type from the socket descriptor?
body: <p>I am writing a program to capture socket network flow to display network activity.
  For this, I was wondering if there is any way I can determine the socket type from the socket descriptor.</p>
  
  <p>I know that I can find socket family using getsockname but I could not find a way to find socket type.</p>
  
  <p>For instance, I want to find if this socket was open as UDP or TCP.
  Thanks for any advice in advance.</p>
  
  <p>YEH</p>