Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jsdario opened this issue Jul 24, 2017 · 4 comments
Open

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

jsdario opened this issue Jul 24, 2017 · 4 comments

Comments

@jsdario
Copy link

jsdario commented Jul 24, 2017

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)
}
@fromkeith
Copy link
Owner

Hi,

I haven't tested this code on a mac... but my guess is this file has the issue: https://github.com/fromkeith/gossdp/blob/master/broadcast_unix.go

Probably around line 86.

That section of code is looking at all your attached network cards, and trying to join the desired multicast group.

Is the code crashing for you? Or are you not seeing any multicast packets being emitted? Or does it exit with the error Unable to find a compatible network interface!?

@jsdario
Copy link
Author

jsdario commented Jul 27, 2017

Hi,

thanks for replying!

The code crashes for me with the error above mentioned:

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

@fromkeith
Copy link
Owner

Can you try add a sleep to the end of the func? That executable immediately exits and stops the server. Which may cause some weirdness...

Eg.

time.Sleep(30 * time.Second)

@hazcod
Copy link

hazcod commented May 8, 2018

Same for me on macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants