Skip to content

Trying to run it for a first time in Mac OSX #5

@jsdario

Description

@jsdario

Hi here!

Much appreciation for your work. I am mostly new to golang and I am struggling with the following error:

join group 8 setsockopt: address family not supported by protocol family

But my code is rather simple. I tried to look it up online but found nothing so far, and think it might be caused by a OS flag that is missing in this package. If I am wrong, please correct me:

Here is the sample:

package main

import (
  "log"
  "github.com/fromkeith/gossdp"
)

func main() {
  log.Println("Running, SSDP advertiser...\n")

  s, err := gossdp.NewSsdp(nil)
  
  if err != nil {
    log.Println("Error creating ssdp server: ", err)
    return
  }
  
  // Define the service we want to advertise
  serverDef := gossdp.AdvertisableServer{
    ServiceType: "bigfoot:all", // define the service type
    DeviceUuid: "hh0c2981-0029-44b7-4u04-27f187aecf78", // make this unique!
    Location: "http://192.168.1.1:8080", // this is the location of the service we are advertising
    MaxAge: 3600, // Max age this advertisment is valid for
  }

  // Call stop  when we are done
  defer s.Stop()

  // run! this will block until stop is called. so open it in a goroutine here
  go s.Start()

  // start advertising it!
  s.AdvertiseServer(serverDef)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions