Hello Udo, thanks for your detailed reply. I am going to try your suggestions and report back afterwards. Not sure though if I get to try it before next weekend. The address I am sending to is definitely a multi-cast address (as defined in the SSDP spec). But what makes me wonder is why the minimal NodeJS example works in both cases without modifications (regular router/accesspoint + camera accesspoint) and the Pharo one only receives data in the first case. But maybe there is something happening behind the curtains in NodeJS when it comes to multi-cast addresses. Thanks, Manfred On Mon, May 18, 2015 at 11:29 PM, Udo Schneider < udo.schneider@homeaddress.de> wrote:
Hi Manfred,
I just stumbled over the IP address you are using (239.255.255.250). If I remember correctly this is a IPv4 Class D Multicast address. (224.0.0.0-239.255.255.255).
So if you want to transmit datagrams to this IP address or recieve datagrams sent to this multicast groups you have to set appropriate IP Options.
You can set this options using Socket>>#setOption:value: and read them using Socket>>#getOption:. Please note that both methods expect the option to set as a name - not as constant. E.g.
socket setOption: 'IP_MULTICAST_IF' value: multicastInterface.
If I do remember correctly you have to set the following options for sending/receiving:
Sending: IP_MULTICAST_IF (IP_MULTICAST_LOOP) (IP_MULTICAST_TTL)
Sending should AFAIK work w/o setting any option - although IP_MULTICAST_IF is highly recommended.
Receiving: (SO_REUSEADDR) IP_ADD_MEMBERSHIP (IP_DROP_MEMBERSHIP)
Receiving only works if you joined the multicast group previously. So I assume that you need to do something like this (not tested).
imrMultiaddr := #[239 255 255 250]. imrInterface := #[0 0 0 0]. ipMreq := imrMultiaddr , imrInterface. socket setOption: 'MEMBERSHIP' value: ipMreq.
Hope this helps.
CU,
Udo
On 18/05/15 16:34, Manfred Kröhnert wrote:
Hi Sven,
On Mon, May 18, 2015 at 4:14 PM, Sven Van Caekenberghe <sven@stfx.eu <mailto:sven@stfx.eu>> wrote:
> On 18 May 2015, at 15:47, Manfred Kröhnert <mkroehnert42@googlemail.com <mailto:mkroehnert42@googlemail.com>> wrote: > > Hi, > apparently I am missing something else. > > I can find devices when connected to a 'regular' LAN. > > However, I have a camera that creates a Wifi accesspoint and makes itself discoverable via SSDP. > Once I connect to this accesspoint my computer gets a valid IP address assigned and the NodeJS code is able to discover the device. > Unfortunately, the Pharo snippet I posted before does not give me any results and hangs in Socket>>waitForDataIfClosed: . > > Any further ideas?
Are you sure you restarted the image and your code after switching networks ?
I did not check this before. But I just downloaded a fresh 40613 image with PharoLauncher and started it after connecting to the camera accesspoint. The code snippet freezes there as well.
Manfred