emNet Berkeley (BSD) socket compatibility

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • emNet Berkeley (BSD) socket compatibility

      Hello,

      i am currently in the process of porting a OPC UA Stack to emNet.
      I am struggeling with the fact, that emNet isn't fully Berkeley socket compatible.

      For example the function setsockopt() doesnt support many hints:
      • IP_MULTICAST_LOOP
      • IP_MULTICAST_IF
      • IP_ADD_MEMBERSHIP
      • IP_DROP_MEMBERSHIP
      Those are all functions related to Multicast.
      IF i understand right, I can mimic the IP_ADD/IP_DROP_MEMBERSHIP options with the emNet Functions IP_IGMP_JoinGroup()/IP_IGMP_LeaveGroup().

      Am i right with this assumption? Are there any possibilitys for the IP_MULTICAST_LOOP/IF option?

      Best regards
      Henrik
    • You are correct, we are almost Berkeley compatible but not up to 100%.

      You can use IP_IGMP_JoinGroup()/IP_IGMP_LeaveGroup() as a replacement for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.


      At the moment there is no alternative for IP_MULTICAST_IF, we are currently working on a new feature which would allow SO_BINDTODEVICE, which in turn would allow you to do something similar to IP_MULTICAST_IF, you can force a specific socket to use a specific interface.


      For IP_MULTICAST_LOOP there is no alternative currently.
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi Hendrik,

      you could use gethostbyname() or if you already have the host as an IP use the IP directly. There is a utility function to help you with that - IP_IPV4_ParseIPv4Addr()
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.
    • Hi,

      i have another question:

      What is the preffered way to bind a socket to a specific Interface?
      Background:
      We want to have several VLAN-Interfaces and want to send traffic from different applications in different vlans.

      Best regards
    • New

      Hi Hendrik,

      since emNet V3.58.0 the setsockopt() option SO_BINDTODEVICE is supported which allows you to bind sockets to a particular interface.
      Please read the forum rules before posting.

      Keep in mind, this is *not* a support forum.
      Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
      Should you be entitled to support you can contact us via our support system: segger.com/ticket/

      Or you can contact us via e-mail.