code: func (m *Manager) BindControl(addr string) error {
  	m.addrMu.Lock()
  	defer m.addrMu.Unlock()
  
  	if m.config.ControlAPI != "" {
  		return errors.New("manager already has a control API address")
  	}
  
  	// don't create a socket directory if we're on windows. we used named pipe
  	if runtime.GOOS != "windows" {
  		err := os.MkdirAll(filepath.Dir(addr), 0700)
  		if err != nil {
  			return errors.Wrap(err, "failed to create socket directory")
  		}
  	}
  
  	l, err := xnet.ListenLocal(addr)
  
  	// A unix socket may fail to bind if the file already
  	// exists. Try replacing the file.
  	if runtime.GOOS != "windows" {
  		unwrappedErr := err
  		if op, ok := unwrappedErr.(*net.OpError); ok {
  			unwrappedErr = op.Err
  		}
  		if sys, ok := unwrappedErr.(*os.SyscallError); ok {
  			unwrappedErr = sys.Err
  		}
  		if unwrappedErr == syscall.EADDRINUSE {
  			os.Remove(addr)
  			l, err = xnet.ListenLocal(addr)
  		}
  	}
  	if err != nil {
  		return errors.Wrap(err, "failed to listen on control API address")
  	}
  
  	m.config.ControlAPI = addr
  	m.controlListener <- l
  	return nil
  }
docs: // BindControl binds a local socket for the control API.