title: How to use fastcgi sockets in golang as a client
body: <p>I've been reading <a href="https://www.mit.edu/%7Eyandros/doc/specs/fcgi-spec.html" rel="nofollow noreferrer">this web page</a> to try to understand the types of data that have to be passed to a fastcgi connection in go. But I do not understand <strong>how</strong> the data has to be passed, if it is in string or some other type of data.</p>
  <p>For example, this is my code:</p>
  <pre><code>conn, err := net.Dial(&quot;unix&quot;, &quot;/run/php-fpm/php-fpm.sock&quot;)
  
  if err != nil {
      log.Print(err)
  }
  </code></pre>
  <p>But I do not understand how (for example) I can send a <a href="https://www.mit.edu/%7Eyandros/doc/specs/fcgi-spec.html#S5.1" rel="nofollow noreferrer">FCGI_BEGIN_REQUEST</a> record, and get which the socket returns. I have been looking for information for days on the internet, but I have not found a clear way to do it or being a &quot;client&quot; of the socket. I would appreciate your help, by the way, I'm completely new to this topic, so if I'm misunderstanding something please tell me, thanks in advance. (just to clarify, I don't have more code than that because I don't know how I have to send the data to the socket)</p>