{"action":"closed","issue":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2766","repository_url":"https://api.github.com/repos/ARMmbed/mbed-os","labels_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2766/labels{/name}","comments_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2766/comments","events_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/2766/events","html_url":"https://github.com/ARMmbed/mbed-os/issues/2766","id":178289693,"number":2766,"title":"Ethernet Multicast Problems","user":{"login":"sstaub","id":6450325,"avatar_url":"https://avatars3.githubusercontent.com/u/6450325?v=4","gravatar_id":"","url":"https://api.github.com/users/sstaub","html_url":"https://github.com/sstaub","followers_url":"https://api.github.com/users/sstaub/followers","following_url":"https://api.github.com/users/sstaub/following{/other_user}","gists_url":"https://api.github.com/users/sstaub/gists{/gist_id}","starred_url":"https://api.github.com/users/sstaub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sstaub/subscriptions","organizations_url":"https://api.github.com/users/sstaub/orgs","repos_url":"https://api.github.com/users/sstaub/repos","events_url":"https://api.github.com/users/sstaub/events{/privacy}","received_events_url":"https://api.github.com/users/sstaub/received_events","type":"User","site_admin":false},"labels":[{"id":515345275,"url":"https://api.github.com/repos/ARMmbed/mbed-os/labels/component:%20networking","name":"component: networking","color":"5319e7","default":false},{"id":28847981,"url":"https://api.github.com/repos/ARMmbed/mbed-os/labels/type:%20enhancement","name":"type: enhancement","color":"cccccc","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2016-09-21T09:12:47Z","updated_at":"2017-10-27T19:12:19Z","closed_at":"2017-10-27T19:12:19Z","author_association":"NONE","body":"Target: LPC1768\nmbed2: build 124\nPriority: Blocker\nTools: PlatformIO\n\nI need to receive two multicast streams from one port but different address (sACN E1.31)\nThe binding of the first socket (A) is ok, but the binding of the second socket (B) fails,\nso I receive only the data from socket A.\nMaybe the problem is that is not possible to bind two sockets on the same port?\nI find no function for binding to an ip-address and port, only for binding to a port.\nAny solution? I posted the problem in the forum, but i got no answer.\n\nHere the code:\n\n```\n/* Multicast Test\n** (c)2016 stefan Staub\n**\n*/\n\n// include mbed libraries\n#include \"mbed.h\"\n#include `\"EthernetInterface.h\"`\n\n// ethernet variables\nconst int PORT = 5568;\n\nchar IP_ADDRESS[] = \"10.101.1.200\";\nchar IP_ADDRESS_MASK[] = \"255.255.0.0\";\nchar IP_ADDRESS_GATEWAY[] = \"0.0.0.0\";\nchar MCAST_GRP_A[] = \"239.255.0.1\";\nchar MCAST_GRP_B[] = \"239.255.0.2\";\n\nint lengthA;\nint lengthB;\n\nchar bufferA[638];\nchar bufferB[638];\n\n// main\nint main() {\n\n  // ethernet\n  EthernetInterface eth;\n  UDPSocket socketA;\n  UDPSocket socketB;\n  Endpoint multiA;\n  Endpoint multiB;\n\n  // ethernet\n  eth.init(IP_ADDRESS, IP_ADDRESS_MASK, IP_ADDRESS_GATEWAY);\n  eth.connect();\n\n  // debug\n  printf(\"IP Address %s\\n\", eth.getIPAddress());\n  printf(\"Subnet %s\\n\", eth.getNetworkMask());\n  printf(\"MAC Address %s\\n\", eth.getMACAddress());\n\n  // udp non blocking\n  socketA.set_blocking (false);\n  socketB.set_blocking (false);\n\n  // Multicast on Socket A -> OK\n  if (socketA.bind(PORT) == -1) {\n    printf(\"socket A bind failed \\n\");\n    }\n  else {\n    printf(\"socket A bind success \\n\");\n    }\n\n  if (socketA.join_multicast_group(MCAST_GRP_A) == -1) {\n    printf(\"multicast A failed \\n\");\n    }\n  else {\n    printf(\"multicast A success \\n\");\n    }\n  // Endpoint A\n  if (multiA.set_address(MCAST_GRP_A, PORT) == -1){\n    printf(\"endpoint A failed \\n\");\n    }\n  else {\n    printf(\"endpoint A success \\n\");\n    }\n\n  // Multicast on Socket B -> Fails when binding\n  if (socketB.bind(PORT) == -1) {\n    printf(\"socket B bind failed \\n\");\n    }\n  else {\n    printf(\"socket B bind success \\n\");\n    }\n  if (socketB.join_multicast_group(MCAST_GRP_B) == -1) {\n    printf(\"multicast B failed \\n\");\n    }\n  else {\n    printf(\"multicast B success \\n\");\n    }\n  // Endpoint B\n  if (multiB.set_address(MCAST_GRP_B, PORT) == -1){\n    printf(\"endpoint B failed \\n\");\n    }\n  else {\n    printf(\"endpoint B success \\n\");\n    }\n\n  // main loop\n  while (true) {\n    lengthA = socketA.receiveFrom(multiA, bufferA, sizeof(bufferA));\n    printf(\"Packet A from %s\\\": %d\\n\", multiA.get_address(), lengthA);\n\n    lengthB = socketB.receiveFrom(multiB, bufferB, sizeof(bufferB));\n    printf(\"Packet B from %s\\\": %d\\n\", multiB.get_address(), lengthB);\n    }\n  }\n```\n\nsstaub\n"}}
{"actor":{"display_login":"ChiefBureaucraticOfficer"}}