Hello

I am having trouble using [netsend] from Bela to PD running on my laptop. Should the patch running on bela connect to http://192.168.7.2/ or localhost? (i tried both to no avail)

I am able to successfully send data from my laptop to bela via [netsend] to http://192.168.7.2/, so it rules out the issues described in the thread above.

thank you
James

What is created by the USB driver is a local network between Bela and the host computer, where each device has a different IP:

  • host computer is 192.168.7.1
  • Bela is 192.168.7.2

As usual, each device can send data to itself at the IP address 127.0.0.1, or equivalently the named server localhost.

Therefore the host would use the following to send to Bela:

[loadbang]
|
[connect 192.168.7.2(
|
[netsend]

and Bela would use the following to send to the host:

[loadbang]
|
[connect 192.168.7.1(
|
[netsend]

Hey thank you for the quick and detailed reply (as always!)

For some reason my network shows 2 bela devices (I only have one)

alt text

so I had to use the secondary address of 192.168.6.1 instead of 192.168.7.1 to send from the board.

Not sure why that happened but I'll remember to check that next time.

cheers

    jamesstaub For some reason my network shows 2 bela devices (I only have one)

    this is explained here.

    jamesstaub so I had to use the secondary address of 192.168.6.1 instead of 192.168.7.1 to send from the board.

    That's unexpected to me, I would have expected that either would work. Does the 192.168.7.1 not work?

      giuliomoro no it did not work when my network was showing both. After disconnecting and reconnecting I've got only the .7 address and that's working again

      that's confusing and needs investigation. You may want to disable one of the two networks, e.g.: disable it on the macos side, or by removing the related entries in /etc/network/interfaces and /etc/dhcp/dhcpd.conf on the board (you should reboot after editing, but be careful that a corrupted file may mean you won't be able to connect back to the board, so make sure you backup your projects first).

      3 years later

      Hi, I've got some issue with the [netsend] module on Bela Mini- from what I've observed so far the situation is as follows:

      I run Bela Mini in standalone mode (i.e. not connected to the laptop) and I'm using a wifi dongle to connect to a network. Pure Data patch sends out some data in OSC protocol via [netsend]. Every now and then the whole patch restarts. My suspicion is that it happens due to the loss of connection to the network - the patch crashes when I try to send out some data via OSC (e.g. I press a button which sends a midi note number). The only time it happend while Bela was connected to the laptop, there was some info printed out in the IDE console, but I've neglected to copy it (when I'm trying to recreate the situation now with Bela connected to the laptop, strangely it doesn't happen, even if I turn off the wifi router to which Bela is connected). So I don't have any report from the console that I could post here, unfortunately.

      The main question, though, is as follows: is there a way to make [netsend] behave the same way it does when Pd runs on a laptop - i.e. when the device disconnects from the network, rather than crash, [netsend] sends "0" to it's left outlet, which could be used to try and reestablish the connection? I don't mind if I loose snippets of OSC data every now and then, but a crash and a restart is a major problem for me.

      After it crashes , log onto the board and access the log with journalctl -u bela_startup -n 2000 --boot | cat and see if there is any useful information there.

      I've managed to recreate the situation. Here's the info from the Bela IDE console:

      I/O thread warning: Error on outgoing socket. Discarding 0 bytes of anoutgoing packet of size 16
      I/O thread warning: failed sendto(63, 0x4a0840, 16, 0, 0xb587bd70, 16) call: 101 Network is unreachable
      Segmentation fault
      make: *** [runide] Error 139
      Makefile:613: recipe for target 'runide' failed
      Bela stopped

      You should be able to reproduce the issue by running this patch on Bela mini: https://krzysztofcybulski.com/netsend_test.pd
      It implies that Bela has a wifi dongle and tries to connect to a network. The issue happens when the network is not present (i.e. router turned off).

      In the patch, I've tried to create a workaround - there's a [spigot] module, which is supposed to stop date being sent to [netsend] while the network is not available, but it doesn't seem to work. There's also a supposed auto-reset function - every time [netsend] sends out "0" to its left output, it attempts to reconnect after 1000 ms.

      alt text

        a month later

        I've recently tested the auto-reset function that I've implemented in the patch above and it works perfectly on a laptop, but no success on a Bela Mini. Bela always seems to restart whenever the connection is lost.

        I didn't manage to reproduce the issue with the crash upon connection loss. What's the version number Pd on Bela that you see on patch startup? Maybe try updating your Bela code to the latest from the dev branch and see if that works?

          Thank's a lot for checking it for me!

          giuliomoro What's the version number Pd on Bela that you see on patch startup?

          bela stdbuf[633]: pd 0.51.4

          I'm also not sure what it means:

          giuliomoro try updating your Bela code to the latest from the dev branch

          I suppose it's some different kind of update from the regular, IDE-based "UPDATE BELA" procedure?

          it doesn't seem too bad, but updating to the latest version will make sure we are testing on the very same version.

          15 days later

          krzysztofcybulski The issue happens when the network is not present (i.e. router turned off).

          is this when the network is not present from the beginning or when it is present when the program starts but is switched off while it's running?

            4 days later

            giuliomoro is this when the network is not present from the beginning or when it is present when the program starts but is switched off while it's running?

            Thanks for asking, it definitely happens each time I'm booting Bela while the network is not present. The Pd patch restarts over and over until I turn on the router, and it eventually connects and the patch continues as desired. Strangely enough, when I purposefuly turn the router off, it doesn't always make the Pd patch restart. However, the patch seems to restart spontaneously at random moments (although very seldom - I thing I've only encountered it once or twice) and it definitely restarts when I walk away from the router far enough so that Bela is not within the reach of the network. The real problem, though, is when the patch seems to be connected for a period of time and I try to send some OSC from the patch and it suddenly restarts.

            In general, it's not that much of an issue as it usually happens only while I turn on Bela (sometimes the Pd patch would restart a couple of times before settling, or would restart once or twice while trying to send out some data over OSC) and when it eventually settles, it stays on for hours. Neverteless, I'm using two Bela-powered instruments for a piece on a major contemporary music festival and I'd like to exclude the possibility of the issue taking place in the middle of the performance...

            I've just updated Bela from the dev branch and it doesn't seem to change anything.