> On 18 May 2015, at 4:44 , Sven Van Caekenberghe <s...@stfx.eu> wrote: > > >> On 18 May 2015, at 16:34, Manfred Kröhnert <mkroehner...@googlemail.com> >> wrote: >> >> Hi Sven, >> >> On Mon, May 18, 2015 at 4:14 PM, Sven Van Caekenberghe <s...@stfx.eu> wrote: >> >>> On 18 May 2015, at 15:47, Manfred Kröhnert <mkroehner...@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
The socket API is a bit confusing, since it mixes together the API's that match the primitives for sending/receiving TCP/UDP. To receive UDP data on the socket, you need something like: | message udpSocket host buffer read| message := (String crlf join: #('M-SEARCH * HTTP/1.1' 'HOST:239.255.255.250:1900' 'MAN:"ssdp:discover"' 'ST:ssdp:all' 'MX:1')). udpSocket := Socket newUDP. host := (NetNameResolver addressFromString: '239.255.255.250'). udpSocket sendData: message toHost: host port: 1900. buffer := String new:4096. "MX:1 means we expect replies within 1 second, let's be on the safe side and wait 2" 2 seconds wait. read := 1. [read > 0] whileTrue: [ read := (udpSocket receiveUDPDataInto: buffer) first. Transcript show: (buffer copyFrom:1 to:read)] Cheers, Henry