title: How to connect to a Unix Domain Socket in .NET Core in C#
body: <p>I've created a unix socket in .NET Core on Linux (Ubuntu 16.04):</p>
  
  <pre><code>var unixSocket = "/var/run/mysqld/mysqld.sock";
  var socket = new Socket(AddressFamily.Unix, SocketType.Stream, ProtocolType.IP);
  </code></pre>
  
  <p>Now how do I connect the socket?</p>
  
  <p>The .NET Core API lists various <a href="https://docs.microsoft.com/en-us/dotnet/core/api/system.net.sockets.socket#System_Net_Sockets_Socket_Connect_System_Net_EndPoint_" rel="noreferrer">Socket.Connect</a> options, but all except for the first one deal with IP Addresses:</p>
  
  <pre><code>public void Connect(EndPoint remoteEP)
  public void Connect(IPAddress address, int port)
  public void Connect(IPAddress[] addresses, int port)
  public void Connect(string host, int port)
  </code></pre>
  
  <p>The <a href="https://docs.microsoft.com/en-us/dotnet/core/api/system.net#System_Net_EndpointPermission" rel="noreferrer">System.Net API</a> defines a <code>DNSEndpoint</code> and an <code>IPEndpoint</code>, but I can't seem to find a <code>UnixEndpoint</code> or similar class to pass to <code>Socket.Connect(EndPoint remoteEP)</code></p>