Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtpmidid rasberrypi to OSX, import not working but export is. #24

Closed
Rippert opened this issue Jun 2, 2020 · 21 comments
Closed

rtpmidid rasberrypi to OSX, import not working but export is. #24

Rippert opened this issue Jun 2, 2020 · 21 comments

Comments

@Rippert
Copy link

Rippert commented Jun 2, 2020

Trying to connect between an RPi and a mac:

Case 1:
-Set up a network midi session called net1 on the mac using the Audio MIDI Setup GUI.
-Start rtpmidid on the RPi.
-> Two ALSA midi ports appear on the RPi with the names Network and net1.
-connect a MIDI monitor process to the net1 port on the RPi.
-> The GUI on the Mac shows that a new participant has been added named raspberrypi/monitor.
-Try to send MIDI data into the Mac net1 port and watch the RPi monitor port
-> No data is received.
-> Same for the reverse case trying to send MIDI data from the RPi to the Mac

Case 2:
-Set up a network midi session called net1 on the mac using the Audio MIDI Setup GUI.
-Start rtpmidid on the RPi.
-> Two ALSA midi ports appears on the RPi with the names Network and net1.
-Use the Mac GUI to connect the raspberrypi entry in the "Directory" box
-> Now there are 3 ALSA midi ports on the RPI, two of them both named net1.
-Connect a midi monitor process to the SECOND net1 port
-Try to send MIDI data into the Mac net1 port and watch the RPi monitor port
-> Data is received on the RPi monitor process.
-> Same for the reverse case trying to send MIDI data from the RPi to the Mac

I can also connect the monitor process to the Network port on the RPi, manually connect the new raspberrypi/monitor entry from the GUI "Directory" on the Mac and have it work.

So it seems that the export, which requires a manual connection in the Mac GUI works, but the Import, which is more automatic, does not, although the Mac seems to think there is a connection.

I really want to use the Import option so that I can set things up using a script on the RPi without having to use the GUI on the Mac every time.

Am I doing something wrong?

Thanks in advance,
Ted

@Rippert
Copy link
Author

Rippert commented Jun 2, 2020

Here's the output from running rtpmidid from the command line.

I first connect a midi receiver and test it (no data received on RPi) and then disconnect that, connect a midi transmitter and test it (no data received on Mac) and then disconnect that.

The only error I see is the control socket not being setup under /var/run/rtpmidid, because I'm not running rtpmidid inside of systemd.

sudo rtpmidid
[2020-06-02T17:33:33Z] [main.cpp:57] Real Time Protocol Music Instrument Digital Interface Daemon - 20.04.5
[2020-06-02T17:33:33Z] [main.cpp:58] (C) 2019 David Moreno Montero <dmoreno@coralbits.com>
[2020-06-02T17:33:33Z] [mdns_rtpmidi.cpp:85] watch_new 5 1
[2020-06-02T17:33:33Z] [rtpserver.cpp:64] Try listen at :::5004
[2020-06-02T17:33:33Z] [rtpserver.cpp:86] Control port at :::5004
[2020-06-02T17:33:33Z] [rtpserver.cpp:123] Listening RTP MIDI connections at 0.0.0.0:5004, with name: 'raspberrypi'
[2020-06-02T17:33:33Z] [control_socket.cpp:64] Error Listening to socket at /var/run/rtpmidid/control.sock: No such file or directory
[2020-06-02T17:33:33Z] [mdns_rtpmidi.cpp:280] (Browser) NEW: service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-02T17:33:33Z] [mdns_rtpmidi.cpp:280] (Browser) NEW: service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-02T17:33:33Z] [mdns_rtpmidi.cpp:294] (Browser) CACHE_EXHAUSTED
[2020-06-02T17:33:33Z] [mdns_rtpmidi.cpp:294] (Browser) ALL_FOR_NOW
[2020-06-02T17:33:33Z] [mdns_rtpmidi.cpp:229] Discovered service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-02T17:33:33Z] [rtpmidid.cpp:233] New alsa port: 1, connects to host: 10.0.1.13, port: 5004, name: net1
[2020-06-02T17:33:33Z] [mdns_rtpmidi.cpp:229] Discovered service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-02T17:33:34Z] [mdns_rtpmidi.cpp:58] Service '/Client24/EntryGroup1' successfully established
[2020-06-02T17:33:34Z] [mdns_rtpmidi.cpp:280] (Browser) NEW: service 'raspberrypi' of type '_apple-midi._udp' in domain 'local'
[2020-06-02T17:33:34Z] [mdns_rtpmidi.cpp:280] (Browser) NEW: service 'raspberrypi' of type '_apple-midi._udp' in domain 'local'
[2020-06-02T17:33:34Z] [mdns_rtpmidi.cpp:225] Received own announcement
[2020-06-02T17:33:34Z] [mdns_rtpmidi.cpp:225] Received own announcement
[2020-06-02T17:34:32Z] [aseq.cpp:118] New ALSA connection from port receivemidi-net1 (129:0)
[2020-06-02T17:34:32Z] [rtpmidid.cpp:237] Callback on subscribe at rtpmidid: receivemidi-net1
[2020-06-02T17:34:32Z] [rtpclient.cpp:76] Try connect to service at 10.0.1.13:5004
[2020-06-02T17:34:32Z] [rtpclient.cpp:100] Try connect to resolved name: TedsAir.local.nat:5004
[2020-06-02T17:34:32Z] [rtpclient.cpp:117] Connected to resolved name: TedsAir.local.nat:5004
[2020-06-02T17:34:32Z] [rtpclient.cpp:125] Control port, local: 52710, remote at TedsAir.local.nat:5004
[2020-06-02T17:34:32Z] [rtpclient.cpp:151] MIDI PORT at port 52710
[2020-06-02T17:34:32Z] [rtpclient.cpp:176] Connecting control port 52710 to TedsAir.local.nat:5004
[2020-06-02T17:34:32Z] [rtppeer.cpp:144] Got confirmation from net1, initiator_id: 2111692749 (true) ssrc: 4202569609, name: net1, port: Control
[2020-06-02T17:34:32Z] [rtpclient.cpp:181] Connecting midi port 52711 to 10.0.1.13:5005
[2020-06-02T17:34:32Z] [rtppeer.cpp:144] Got confirmation from net1, initiator_id: 2111692749 (true) ssrc: 4202569609, name: net1, port: MIDI
[2020-06-02T17:34:32Z] [rtppeer.cpp:266] Latency net1: 0.10 ms (client / 2)
[2020-06-02T17:35:15Z] [rtpmidid.cpp:241] Callback on unsubscribe at rtpmidid
[2020-06-02T17:35:15Z] [rtpmidid.cpp:288] Disconnect signal: 3
[2020-06-02T17:35:15Z] [rtppeer.cpp:49] ~rtppeer 'raspberrypi/receivemidi-net1' (local) <-> 'net1' (remote)
[2020-06-02T17:35:15Z] [aseq.cpp:127] Disconnected
[2020-06-02T17:35:28Z] [aseq.cpp:118] New ALSA connection from port sendmidi-net1 (129:0)
[2020-06-02T17:35:28Z] [rtpmidid.cpp:237] Callback on subscribe at rtpmidid: sendmidi-net1
[2020-06-02T17:35:28Z] [rtpclient.cpp:76] Try connect to service at 10.0.1.13:5004
[2020-06-02T17:35:28Z] [rtpclient.cpp:100] Try connect to resolved name: TedsAir.local.nat:5004
[2020-06-02T17:35:28Z] [rtpclient.cpp:117] Connected to resolved name: TedsAir.local.nat:5004
[2020-06-02T17:35:28Z] [rtpclient.cpp:125] Control port, local: 56668, remote at TedsAir.local.nat:5004
[2020-06-02T17:35:28Z] [rtpclient.cpp:151] MIDI PORT at port 56668
[2020-06-02T17:35:28Z] [rtpclient.cpp:176] Connecting control port 56668 to TedsAir.local.nat:5004
[2020-06-02T17:35:28Z] [rtppeer.cpp:144] Got confirmation from net1, initiator_id: 1128499544 (true) ssrc: 4202569609, name: net1, port: Control
[2020-06-02T17:35:28Z] [rtpclient.cpp:181] Connecting midi port 56669 to 10.0.1.13:5005
[2020-06-02T17:35:28Z] [rtppeer.cpp:144] Got confirmation from net1, initiator_id: 1128499544 (true) ssrc: 4202569609, name: net1, port: MIDI
[2020-06-02T17:35:28Z] [rtppeer.cpp:266] Latency net1: 0.00 ms (client / 2)
[2020-06-02T17:36:14Z] [rtpmidid.cpp:241] Callback on unsubscribe at rtpmidid
[2020-06-02T17:36:14Z] [rtpmidid.cpp:288] Disconnect signal: 3
[2020-06-02T17:36:14Z] [rtppeer.cpp:49] ~rtppeer 'raspberrypi/sendmidi-net1' (local) <-> 'net1' (remote)
[2020-06-02T17:36:14Z] [aseq.cpp:127] Disconnected

Then I connected using the GUI on the mac and repeated the tests. This time data was recieved on both ends.

The most obvious difference is that the Latency message repeats at regular intervals. Is there some kind of "keep alive" signal not being sent in the first case?

[2020-06-02T17:44:21Z] [rtppeer.cpp:181] Got connection request from net1, initiator_id: 6B8B4567 (true) ssrc: FA7E1F89, name: net1, at control? true
[2020-06-02T17:44:21Z] [rtppeer.cpp:181] Got connection request from net1, initiator_id: 6B8B4567 (true) ssrc: FA7E1F89, name: net1, at control? false
[2020-06-02T17:44:21Z] [rtpmidid.cpp:108] Remote client connects to local server at port 5004. Name: net1
[2020-06-02T17:44:21Z] [rtppeer.cpp:275] Latency net1: 0.00 ms (server / 3)
[2020-06-02T17:44:23Z] [rtppeer.cpp:275] Latency net1: 0.00 ms (server / 3)
[2020-06-02T17:44:24Z] [rtppeer.cpp:275] Latency net1: 0.00 ms (server / 3)
[2020-06-02T17:44:26Z] [rtppeer.cpp:275] Latency net1: 0.10 ms (server / 3)
[2020-06-02T17:44:27Z] [rtppeer.cpp:275] Latency net1: 0.00 ms (server / 3)
[2020-06-02T17:44:29Z] [rtppeer.cpp:275] Latency net1: 0.10 ms (server / 3)
[2020-06-02T17:44:39Z] [rtppeer.cpp:275] Latency net1: 0.00 ms (server / 3)
[2020-06-02T17:44:49Z] [rtppeer.cpp:275] Latency net1: 0.00 ms (server / 3)
[2020-06-02T17:44:59Z] [rtppeer.cpp:275] Latency net1: 0.10 ms (server / 3)
[2020-06-02T17:45:09Z] [rtppeer.cpp:275] Latency net1: 0.00 ms (server / 3)
[2020-06-02T17:45:19Z] [rtppeer.cpp:275] Latency net1: 0.10 ms (server / 3)
[2020-06-02T17:45:26Z] [aseq.cpp:118] New ALSA connection from port receivemidi-net1 (129:0)
[2020-06-02T17:45:29Z] [rtppeer.cpp:275] Latency net1: 0.00 ms (server / 3)
[2020-06-02T17:45:39Z] [rtppeer.cpp:275] Latency net1: 0.10 ms (server / 3)
[2020-06-02T17:45:49Z] [rtppeer.cpp:275] Latency net1: 0.10 ms (server / 3)
[2020-06-02T17:45:49Z] [aseq.cpp:127] Disconnected
[2020-06-02T17:45:59Z] [rtppeer.cpp:275] Latency net1: 0.00 ms (server / 3)
[2020-06-02T17:46:01Z] [aseq.cpp:118] New ALSA connection from port sendmidi-net1 (129:0)
[2020-06-02T17:46:09Z] [rtppeer.cpp:275] Latency net1: 0.00 ms (server / 3)
[2020-06-02T17:46:14Z] [rtppeer.cpp:339] Got feedback until package 51746 / 51746. No journal, so ignoring.
[2020-06-02T17:46:16Z] [aseq.cpp:127] Disconnected
[2020-06-02T17:46:19Z] [rtppeer.cpp:275] Latency net1: 0.00 ms (server / 3)
[2020-06-02T17:46:29Z] [rtppeer.cpp:275] Latency net1: 0.00 ms (server / 3)
[2020-06-02T17:46:30Z] [rtpserver.cpp:211] Unknown peer, and not connect on control. Ignoring. Control port.
FF FF 42 59  00 00 00 02  00 00 00 00  FA 7E 1F 89  

..BY .... .... .~.. 

@davidmoreno
Copy link
Owner

Hi, thanks for the report.

I think you are on the spot on missing latency keep alive (I'm having that exact issue on the windows rtpmidi). But it should at least send messages for some seconds. Actually I'm not sure if I'm having also the same problem of the initial report of remote can connect, but local cant.

I will try to work on it a bit and keep you informed.

BTW: check https://github.com/davidmoreno/aseqrc which I think is for the same case you want but no need for scripts.

Thanks,
David.

@davidmoreno
Copy link
Owner

I worked a bit on my problem, but now I'm no so sure they are connected. Anyway I changed some paths and added some more debug info.

Do you mind trying it again?

Also if you have any other device with rtpmidi that works as expected in mac, can you send me the tcpdump? So I can see the differences. Maybe we do something wrong. You can get them with:

tcpdump -s 65536 -w dump '(port 5004) or (port 5005)' -i eth0

(tested on linux, should be the same)

@Rippert
Copy link
Author

Rippert commented Jun 2, 2020

Still not working. Getting more latency messages, but their irregular and both server and client messages come in pairs. I can run an "rtpmidi" session between two macs if that's what you mean. That should work correctly. Do you want the tcpdump on the server, client or both?

/usr/local/usr/bin/rtpmidid
[2020-06-02T21:08:24Z] [main.cpp:58] Real Time Protocol Music Instrument Digital Interface Daemon - 20.04.5
[2020-06-02T21:08:24Z] [main.cpp:59] (C) 2019 David Moreno Montero <dmoreno@coralbits.com>
[2020-06-02T21:08:24Z] [mdns_rtpmidi.cpp:89] watch_new 5 1
[2020-06-02T21:08:24Z] [rtpserver.cpp:63] Try listen at :::5004
[2020-06-02T21:08:24Z] [rtpserver.cpp:89] Control port at :::5004
[2020-06-02T21:08:24Z] [rtpserver.cpp:129] Listening RTP MIDI connections at 0.0.0.0:5004, with name: 'raspberrypi'
[2020-06-02T21:08:24Z] [control_socket.cpp:70] Error Listening to socket at /var/run/rtpmidid/control.sock: No such file or directory
[2020-06-02T21:08:24Z] [mdns_rtpmidi.cpp:304] (Browser) CACHE_EXHAUSTED
[2020-06-02T21:08:24Z] [mdns_rtpmidi.cpp:283] (Browser) NEW: service 'raspberrypi' of type '_apple-midi._udp' in domain 'local'
[2020-06-02T21:08:24Z] [mdns_rtpmidi.cpp:283] (Browser) NEW: service 'raspberrypi' of type '_apple-midi._udp' in domain 'local'
[2020-06-02T21:08:25Z] [mdns_rtpmidi.cpp:58] Service '/Client25/EntryGroup1' successfully established
[2020-06-02T21:08:25Z] [mdns_rtpmidi.cpp:229] Received own announcement
[2020-06-02T21:08:25Z] [mdns_rtpmidi.cpp:229] Received own announcement
[2020-06-02T21:08:25Z] [mdns_rtpmidi.cpp:304] (Browser) ALL_FOR_NOW
[2020-06-02T21:08:47Z] [mdns_rtpmidi.cpp:283] (Browser) NEW: service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-02T21:08:47Z] [mdns_rtpmidi.cpp:283] (Browser) NEW: service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-02T21:08:47Z] [mdns_rtpmidi.cpp:234] Discovered service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-02T21:08:47Z] [rtpmidid.cpp:254] New alsa port: 1, connects to host: 10.0.1.13, port: 5004, name: net1
[2020-06-02T21:08:47Z] [mdns_rtpmidi.cpp:234] Discovered service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-02T21:09:16Z] [aseq.cpp:123] New ALSA connection from port receivemidi-net1 (129:0)
[2020-06-02T21:09:16Z] [rtpmidid.cpp:259] Callback on subscribe at rtpmidid: receivemidi-net1
[2020-06-02T21:09:16Z] [rtpclient.cpp:77] Try connect to service at 10.0.1.13:5004
[2020-06-02T21:09:16Z] [rtpclient.cpp:99] Try connect to resolved name: TedsAir.local.nat:5004
[2020-06-02T21:09:16Z] [rtpclient.cpp:118] Connected to resolved name: TedsAir.local.nat:5004
[2020-06-02T21:09:16Z] [rtpclient.cpp:127] Control port, local: 33182, remote at TedsAir.local.nat:5004
[2020-06-02T21:09:16Z] [rtpclient.cpp:156] MIDI PORT at port 33182
[2020-06-02T21:09:16Z] [rtpclient.cpp:182] Connecting control port 33182 to TedsAir.local.nat:5004
[2020-06-02T21:09:16Z] [rtppeer.cpp:154] Got confirmation from net1, initiator_id: 903826663 (true) ssrc: 1857509326, name: net1, port: Control
[2020-06-02T21:09:16Z] [rtpclient.cpp:189] Connecting midi port 33183 to 10.0.1.13:5005
[2020-06-02T21:09:16Z] [rtppeer.cpp:154] Got confirmation from net1, initiator_id: 903826663 (true) ssrc: 1857509326, name: net1, port: MIDI
[2020-06-02T21:09:16Z] [rtppeer.cpp:347] Send CK0 to net1
[2020-06-02T21:09:16Z] [rtppeer.cpp:288] Latency net1: 0.00 ms (client / 2)
[2020-06-02T21:09:36Z] [rtppeer.cpp:347] Send CK0 to net1
[2020-06-02T21:09:36Z] [rtppeer.cpp:288] Latency net1: 0.00 ms (client / 2)
[2020-06-02T21:09:36Z] [rtppeer.cpp:295] Latency net1: 0.00 ms (server / 3)
[2020-06-02T21:09:56Z] [rtppeer.cpp:347] Send CK0 to net1
[2020-06-02T21:09:56Z] [rtppeer.cpp:288] Latency net1: 0.00 ms (client / 2)
[2020-06-02T21:09:56Z] [rtppeer.cpp:295] Latency net1: 0.00 ms (server / 3)
[2020-06-02T21:10:07Z] [rtpmidid.cpp:264] Callback on unsubscribe at rtpmidid
[2020-06-02T21:10:07Z] [rtpmidid.cpp:328] Disconnect signal: 3
[2020-06-02T21:10:07Z] [rtppeer.cpp:50] ~rtppeer 'raspberrypi/receivemidi-net1' (local) <-> 'net1' (remote)
[2020-06-02T21:10:07Z] [aseq.cpp:131] Disconnected
[2020-06-02T21:10:24Z] [aseq.cpp:123] New ALSA connection from port sendmidi-net1 (129:0)
[2020-06-02T21:10:24Z] [rtpmidid.cpp:259] Callback on subscribe at rtpmidid: sendmidi-net1
[2020-06-02T21:10:24Z] [rtpclient.cpp:77] Try connect to service at 10.0.1.13:5004
[2020-06-02T21:10:24Z] [rtpclient.cpp:99] Try connect to resolved name: TedsAir.local.nat:5004
[2020-06-02T21:10:24Z] [rtpclient.cpp:118] Connected to resolved name: TedsAir.local.nat:5004
[2020-06-02T21:10:24Z] [rtpclient.cpp:127] Control port, local: 33524, remote at TedsAir.local.nat:5004
[2020-06-02T21:10:24Z] [rtpclient.cpp:156] MIDI PORT at port 33524
[2020-06-02T21:10:24Z] [rtpclient.cpp:182] Connecting control port 33524 to TedsAir.local.nat:5004
[2020-06-02T21:10:24Z] [rtppeer.cpp:154] Got confirmation from net1, initiator_id: 1460329899 (true) ssrc: 1857509326, name: net1, port: Control
[2020-06-02T21:10:24Z] [rtpclient.cpp:189] Connecting midi port 33525 to 10.0.1.13:5005
[2020-06-02T21:10:24Z] [rtppeer.cpp:154] Got confirmation from net1, initiator_id: 1460329899 (true) ssrc: 1857509326, name: net1, port: MIDI
[2020-06-02T21:10:24Z] [rtppeer.cpp:347] Send CK0 to net1
[2020-06-02T21:10:24Z] [rtppeer.cpp:288] Latency net1: 0.00 ms (client / 2)
[2020-06-02T21:10:44Z] [rtppeer.cpp:347] Send CK0 to net1
[2020-06-02T21:10:44Z] [rtppeer.cpp:288] Latency net1: 0.00 ms (client / 2)
[2020-06-02T21:10:44Z] [rtppeer.cpp:295] Latency net1: 0.00 ms (server / 3)
[2020-06-02T21:11:04Z] [rtppeer.cpp:347] Send CK0 to net1
[2020-06-02T21:11:04Z] [rtppeer.cpp:288] Latency net1: 0.00 ms (client / 2)
[2020-06-02T21:11:04Z] [rtppeer.cpp:295] Latency net1: 0.00 ms (server / 3)
[2020-06-02T21:11:24Z] [rtppeer.cpp:347] Send CK0 to net1
[2020-06-02T21:11:25Z] [rtppeer.cpp:288] Latency net1: 0.00 ms (client / 2)
[2020-06-02T21:11:36Z] [rtpmidid.cpp:264] Callback on unsubscribe at rtpmidid
[2020-06-02T21:11:36Z] [rtpmidid.cpp:328] Disconnect signal: 3
[2020-06-02T21:11:36Z] [rtppeer.cpp:50] ~rtppeer 'raspberrypi/sendmidi-net1' (local) <-> 'net1' (remote)
[2020-06-02T21:11:36Z] [aseq.cpp:131] Disconnected
^C[2020-06-02T21:11:43Z] [main.cpp:45] SIGINT received. Closing.
[2020-06-02T21:11:43Z] [main.cpp:74] FIN

@Rippert
Copy link
Author

Rippert commented Jun 3, 2020

OK, I managed to get a windows virtual machine running rtpMIDI to connect to my Mac. I captured tcpdump's with the mac as both a client and a server. Both worked. The test was:
-start tcpdump
-connect the two network midi ports
-send data and receive data on both ends
-close connection
-stop tcpdump

The files are attached

dumpclient.zip
dumpserver.zip

@Rippert
Copy link
Author

Rippert commented Jun 3, 2020

I noticed that rtpMIDI on Windows had a diagnostic output option. I set it on Verbose and connected and disconnected the Mac net1 MIDI port (using the Windows rtpMIDI GUI). Here is the output from that:

[     3032.950] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Starting up peer
[     3032.983] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Startup-Thread started: 
[     3032.993] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Trying to resolve host by DNSSD:net1
[     3034.008] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6:net1: Resolved at this time:10.0.1.13
[     3034.019] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1:  Peer mac is: E0-AC-CB-9D-F7-44
[     3034.028] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Sending INVITE on control-port to resolved host: 10.0.1.13(5004)
[     3034.035] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-CTRL:DESKTOP-8S0BNE6:10.0.1.13:5004:Invite(DESKTOP-8S0BNE6): FF FF 49 4E 00 00 00 02 58 C1 08 F5 79 07 E8 70 44 45 53 4B 54 4F 50 2D 38 53 30 42 4E 45 36 00 
[     3034.044] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: RX-CTRL:DESKTOP-8S0BNE6:10.0.1.13:5004:Accepted(net1): FF FF 4F 4B 00 00 00 02 58 C1 08 F5 DB 72 48 E9 6E 65 74 31 00 
[     3034.054] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:  peer mac is: E0-AC-CB-9D-F7-44
[     3034.062] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Our connection on ctrl-port was accepted
[     3034.144] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Connection to control-port established: 10.0.1.13(5004)
[     3034.153] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Sending INVITE on midi-port to resolved host: 10.0.1.13(5005)
[     3034.160] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Invite(DESKTOP-8S0BNE6): FF FF 49 4E 00 00 00 02 58 C1 08 F5 79 07 E8 70 44 45 53 4B 54 4F 50 2D 38 53 30 42 4E 45 36 00 
[     3034.168] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: RX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Accepted(net1): FF FF 4F 4B 00 00 00 02 58 C1 08 F5 DB 72 48 E9 6E 65 74 31 00 
[     3034.176] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1:: Our connection on midi-port was accepted
[     3034.269] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Connection to MIDI-port established: 10.0.1.13(5005)
[     3034.281] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Initial-Sync to peer
[     3034.289] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 00 00 00 00 00 00 00 00 01 CE F9 7C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[     3034.299] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: RX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B DB 72 48 E9 01 00 00 00 00 00 00 00 01 CE F9 7C 00 00 00 00 00 18 65 8B 00 00 00 00 00 00 00 00 
[     3034.309] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 02 00 00 00 00 00 00 00 01 CE F9 7C 00 00 00 00 00 18 65 8B 00 00 00 00 01 CE FA 42 
[     3034.319] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Latency=198
[     3035.800] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Initial-Sync to peer
[     3035.809] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 00 00 00 00 00 00 00 00 01 CF 34 DE 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[     3035.818] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: RX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B DB 72 48 E9 01 00 00 00 00 00 00 00 01 CF 34 DE 00 00 00 00 00 18 A0 DB 00 00 00 00 00 00 00 00 
[     3035.818] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 02 00 00 00 00 00 00 00 01 CF 34 DE 00 00 00 00 00 18 A0 DB 00 00 00 00 01 CF 35 71 
[     3035.831] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Latency=147
[     3035.836] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: RX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B DB 72 48 E9 00 36 55 61 00 00 00 00 00 18 A1 61 00 70 00 00 E1 08 58 39 FF 7F 00 00 20 00 00 00 
[     3035.841] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 01 00 00 00 00 00 00 00 00 18 A1 61 00 00 00 00 01 CF 36 3E 00 00 00 00 00 00 00 00 
[     3035.852] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: RX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B DB 72 48 E9 02 00 00 00 00 00 00 00 00 18 A1 61 00 00 00 00 01 CF 36 3E 00 00 00 00 00 18 A2 2E 
[     3035.858] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Latency=148
[     3037.319] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Initial-Sync to peer
[     3037.328] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 00 00 00 00 00 00 00 00 01 CF 70 33 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[     3037.339] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: RX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B DB 72 48 E9 01 00 00 00 00 00 00 00 01 CF 70 33 00 00 00 00 00 18 DC 3D 00 00 00 00 00 00 00 00 
[     3037.349] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 02 00 00 00 00 00 00 00 01 CF 70 33 00 00 00 00 00 18 DC 3D 00 00 00 00 01 CF 71 03 
[     3037.359] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Latency=208
[     3037.369] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: RX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B DB 72 48 E9 00 36 55 61 00 00 00 00 00 18 DD 16 20 44 C2 41 0C E8 15 B5 20 44 C2 41 E8 3F D1 3F 
[     3037.383] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 01 00 00 00 00 00 00 00 00 18 DD 16 00 00 00 00 01 CF 72 5B 00 00 00 00 00 00 00 00 
[     3037.396] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: RX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B DB 72 48 E9 02 00 00 00 00 00 00 00 00 18 DD 16 00 00 00 00 01 CF 72 5B 00 00 00 00 00 18 DE 83 
[     3037.408] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Latency=248
[     3038.839] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Initial-Sync to peer
[     3038.848] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 00 00 00 00 00 00 00 00 01 CF AB 98 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[     3038.860] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: RX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B DB 72 48 E9 01 00 00 00 00 00 00 00 01 CF AB 98 00 00 00 00 00 19 17 AD 00 00 00 00 00 00 00 00 
[     3038.870] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 02 00 00 00 00 00 00 00 01 CF AB 98 00 00 00 00 00 19 17 AD 00 00 00 00 01 CF AC 74 
[     3038.881] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Latency=220
[     3040.568] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Initial-Sync to peer
[     3040.622] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 00 00 00 00 00 00 00 00 01 CF F0 DE 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[     3040.635] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: RX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B DB 72 48 E9 01 00 00 00 00 00 00 00 01 CF F0 DE 00 00 00 00 00 19 5D 08 00 00 00 00 00 00 00 00 
[     3040.646] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 02 00 00 00 00 00 00 00 01 CF F0 DE 00 00 00 00 00 19 5D 08 00 00 00 00 01 CF F1 D4 
[     3040.654] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Latency=246
[     3042.136] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Initial-Sync to peer
[     3042.146] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 00 00 00 00 00 00 00 00 01 D0 2C 63 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[     3042.154] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: RX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B DB 72 48 E9 01 00 00 00 00 00 00 00 01 D0 2C 63 00 00 00 00 00 19 98 5D 00 00 00 00 00 00 00 00 
[     3042.162] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 02 00 00 00 00 00 00 00 01 D0 2C 63 00 00 00 00 00 19 98 5D 00 00 00 00 01 D0 2D 0C 
[     3042.171] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Latency=169
[     3043.654] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Initial Sync done
[     3043.663] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Now waiting for disconnect from outside...
[     3052.888] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 00 00 00 00 00 00 00 00 01 D1 D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[     3052.897] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: RX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B DB 72 48 E9 01 00 00 00 00 00 00 00 01 D1 D0 00 00 00 00 00 00 1B 3C 00 00 00 00 00 00 00 00 00 
[     3052.906] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 02 00 00 00 00 00 00 00 01 D1 D0 00 00 00 00 00 00 1B 3C 00 00 00 00 00 01 D1 D0 B2 
[     3052.915] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Latency=178
[     3062.895] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 00 00 00 00 00 00 00 00 01 D3 56 EE 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
[     3062.906] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: RX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B DB 72 48 E9 01 00 00 00 00 00 00 00 01 D3 56 EE 00 00 00 00 00 1C C2 FA 00 00 00 00 00 00 00 00 
[     3062.914] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-MIDI:DESKTOP-8S0BNE6:10.0.1.13:5005:Synchronize: FF FF 43 4B 79 07 E8 70 02 00 00 00 00 00 00 00 01 D3 56 EE 00 00 00 00 00 1C C2 FA 00 00 00 00 01 D3 57 A2 
[     3062.922] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Latency=180
[     3070.125] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Shutting down peer
[     3070.139] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Thread externally aborted
[     3070.153] rtpMIDI_1_1_14_247 [ DIAG_INFO    ]: DESKTOP-8S0BNE6:net1: Outboundthread terminated
[     3070.161] rtpMIDI_1_1_14_247 [ DIAG_VERBOSE ]: DESKTOP-8S0BNE6: TX-CTRL:DESKTOP-8S0BNE6:10.0.1.13:5004:Shutdown: FF FF 42 59 00 00 00 02 7C 0A C8 4D 79 07 E8 70 

@davidmoreno
Copy link
Owner

From you dumps I see there is a ck handshake: send 6 ck feedback requests 1.5s seconds apart, and then send every 10 seconds.

I changed the code to do the same. Let me know if it works.

@Rippert
Copy link
Author

Rippert commented Jun 4, 2020

It does now work, but only on the first connection after the daemon is started. If you disconnect and then reconnect to the net1 midi port no data will flow. Stopping the rtpmidid daemon and starting again fixes this, but, again, only for the first connection.

This usable as is, but I can disconnect and reconnect from the Mac and have the data flow resume. So something is still not right. Let me know if you want any other data I can provide.

Here's the output from the daemon process:

pi@raspberrypi:~/src/rtpmidid $ make run
mkdir -p build
cd build &&	cmake .. -DCMAKE_BUILD_TYPE=Release
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/src/rtpmidid/build
cd build && make -j
make[1]: Entering directory '/home/pi/src/rtpmidid/build'
make[2]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
[ 45%] Built target rtpmididlib
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
[ 58%] Built target test_rtpserver
[ 75%] Built target rtpmidid
[ 87%] Built target test_mdns
[100%] Built target test_rtppeer
make[2]: Leaving directory '/home/pi/src/rtpmidid/build'
make[1]: Leaving directory '/home/pi/src/rtpmidid/build'
build/src/rtpmidid --port 10000
[2020-06-04T21:28:29Z] [main.cpp:58] Real Time Protocol Music Instrument Digital Interface Daemon - 20.04.5
[2020-06-04T21:28:29Z] [main.cpp:59] (C) 2019 David Moreno Montero <dmoreno@coralbits.com>
[2020-06-04T21:28:29Z] [mdns_rtpmidi.cpp:89] watch_new 5 1
[2020-06-04T21:28:29Z] [rtpserver.cpp:63] Try listen at :::10000
[2020-06-04T21:28:29Z] [rtpserver.cpp:89] Control port at :::10000
[2020-06-04T21:28:29Z] [rtpserver.cpp:129] Listening RTP MIDI connections at 0.0.0.0:10000, with name: 'raspberrypi'
[2020-06-04T21:28:29Z] [control_socket.cpp:58] Removed old control socket. Creating new one.
[2020-06-04T21:28:29Z] [control_socket.cpp:79] Control socket ready at /var/run/rtpmidid/control.sock
[2020-06-04T21:28:29Z] [mdns_rtpmidi.cpp:285] (Browser) NEW: service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-04T21:28:29Z] [mdns_rtpmidi.cpp:285] (Browser) NEW: service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-04T21:28:29Z] [mdns_rtpmidi.cpp:306] (Browser) CACHE_EXHAUSTED
[2020-06-04T21:28:29Z] [mdns_rtpmidi.cpp:306] (Browser) ALL_FOR_NOW
[2020-06-04T21:28:29Z] [mdns_rtpmidi.cpp:236] Discovered service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-04T21:28:29Z] [rtpmidid.cpp:255] New alsa port: 1, connects to host: 10.0.1.13, port: 5004, name: net1
[2020-06-04T21:28:29Z] [mdns_rtpmidi.cpp:236] Discovered service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-04T21:28:30Z] [mdns_rtpmidi.cpp:58] Service '/Client36/EntryGroup1' successfully established
[2020-06-04T21:28:30Z] [mdns_rtpmidi.cpp:285] (Browser) NEW: service 'raspberrypi' of type '_apple-midi._udp' in domain 'local'
[2020-06-04T21:28:30Z] [mdns_rtpmidi.cpp:285] (Browser) NEW: service 'raspberrypi' of type '_apple-midi._udp' in domain 'local'
[2020-06-04T21:28:30Z] [mdns_rtpmidi.cpp:231] Received own announcement
[2020-06-04T21:28:30Z] [mdns_rtpmidi.cpp:231] Received own announcement
[2020-06-04T21:28:38Z] [aseq.cpp:123] New ALSA connection from port receivemidi-net1 (130:0)
[2020-06-04T21:28:38Z] [rtpmidid.cpp:260] Callback on subscribe at rtpmidid: receivemidi-net1
[2020-06-04T21:28:38Z] [rtpclient.cpp:78] Try connect to service at 10.0.1.13:5004
[2020-06-04T21:28:38Z] [rtpclient.cpp:100] Try connect to resolved name: TedsAir.local.nat:5004
[2020-06-04T21:28:38Z] [rtpclient.cpp:119] Connected to resolved name: TedsAir.local.nat:5004
[2020-06-04T21:28:38Z] [rtpclient.cpp:128] Control port, local: 38370, remote at TedsAir.local.nat:5004
[2020-06-04T21:28:38Z] [rtpclient.cpp:157] MIDI PORT at port 38370
[2020-06-04T21:28:38Z] [rtpclient.cpp:183] Connecting control port 38370 to TedsAir.local.nat:5004
[2020-06-04T21:28:39Z] [rtppeer.cpp:155] Got confirmation from net1, initiator_id: 1441748415 (true) ssrc: 896799374, name: net1, port: Control
[2020-06-04T21:28:39Z] [rtpclient.cpp:190] Connecting midi port 38371 to 10.0.1.13:5005
[2020-06-04T21:28:39Z] [rtppeer.cpp:155] Got confirmation from net1, initiator_id: 1441748415 (true) ssrc: 896799374, name: net1, port: MIDI
[2020-06-04T21:28:39Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-04T21:28:39Z] [rtppeer.cpp:289] Latency net1: 1.30 ms (client / 2)
[2020-06-04T21:28:40Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-04T21:28:40Z] [rtppeer.cpp:289] Latency net1: 339.60 ms (client / 2)
[2020-06-04T21:28:40Z] [rtppeer.cpp:298] Latency net1: 1.20 ms (server / 3)
[2020-06-04T21:28:42Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-04T21:28:42Z] [rtppeer.cpp:289] Latency net1: 339.90 ms (client / 2)
[2020-06-04T21:28:42Z] [rtppeer.cpp:298] Latency net1: 1.20 ms (server / 3)
[2020-06-04T21:28:44Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-04T21:28:44Z] [rtppeer.cpp:289] Latency net1: 340.20 ms (client / 2)
[2020-06-04T21:28:46Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-04T21:28:46Z] [rtppeer.cpp:289] Latency net1: 342.50 ms (client / 2)
[2020-06-04T21:28:56Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-04T21:28:56Z] [rtppeer.cpp:289] Latency net1: 130.70 ms (client / 2)
[2020-06-04T21:29:06Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-04T21:29:06Z] [rtppeer.cpp:289] Latency net1: 128.50 ms (client / 2)
[2020-06-04T21:29:08Z] [rtppeer.cpp:405] This RTP MIDI header has journal. Not implemented yet. Ignoring.
[2020-06-04T21:29:14Z] [rtpmidid.cpp:265] Callback on unsubscribe at rtpmidid
[2020-06-04T21:29:14Z] [rtpmidid.cpp:329] Disconnect signal: 3
[2020-06-04T21:29:14Z] [rtppeer.cpp:51] ~rtppeer 'raspberrypi/receivemidi-net1' (local) <-> 'net1' (remote)
[2020-06-04T21:29:14Z] [aseq.cpp:131] Disconnected
[2020-06-04T21:29:24Z] [aseq.cpp:123] New ALSA connection from port receivemidi-net1 (130:0)
[2020-06-04T21:29:24Z] [rtpmidid.cpp:260] Callback on subscribe at rtpmidid: receivemidi-net1
[2020-06-04T21:29:24Z] [rtpclient.cpp:78] Try connect to service at 10.0.1.13:5004
[2020-06-04T21:29:24Z] [rtpclient.cpp:100] Try connect to resolved name: TedsAir.local.nat:5004
[2020-06-04T21:29:24Z] [rtpclient.cpp:119] Connected to resolved name: TedsAir.local.nat:5004
[2020-06-04T21:29:24Z] [rtpclient.cpp:128] Control port, local: 50367, remote at TedsAir.local.nat:5004
[2020-06-04T21:29:24Z] [rtpclient.cpp:157] MIDI PORT at port 50367
[2020-06-04T21:29:24Z] [rtpclient.cpp:183] Connecting control port 50367 to TedsAir.local.nat:5004
[2020-06-04T21:29:25Z] [rtppeer.cpp:155] Got confirmation from net1, initiator_id: 585129178 (true) ssrc: 896799374, name: net1, port: Control
[2020-06-04T21:29:25Z] [rtpclient.cpp:190] Connecting midi port 50368 to 10.0.1.13:5005
[2020-06-04T21:29:25Z] [rtppeer.cpp:155] Got confirmation from net1, initiator_id: 585129178 (true) ssrc: 896799374, name: net1, port: MIDI
[2020-06-04T21:29:25Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-04T21:29:25Z] [rtppeer.cpp:289] Latency net1: 1.20 ms (client / 2)
[2020-06-04T21:29:35Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-04T21:29:35Z] [rtppeer.cpp:289] Latency net1: 126.40 ms (client / 2)
[2020-06-04T21:29:35Z] [rtppeer.cpp:298] Latency net1: 1.10 ms (server / 3)
[2020-06-04T21:29:45Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-04T21:29:46Z] [rtppeer.cpp:289] Latency net1: 126.10 ms (client / 2)
[2020-06-04T21:29:46Z] [rtppeer.cpp:298] Latency net1: 1.20 ms (server / 3)
[2020-06-04T21:29:48Z] [rtpmidid.cpp:265] Callback on unsubscribe at rtpmidid
[2020-06-04T21:29:48Z] [rtpmidid.cpp:329] Disconnect signal: 3
[2020-06-04T21:29:48Z] [rtppeer.cpp:51] ~rtppeer 'raspberrypi/receivemidi-net1' (local) <-> 'net1' (remote)
[2020-06-04T21:29:48Z] [aseq.cpp:131] Disconnected
^C[2020-06-04T21:29:53Z] [main.cpp:45] SIGINT received. Closing.
[2020-06-04T21:29:53Z] [main.cpp:74] FIN

@davidmoreno
Copy link
Owner

I'm checking against windows rtpmidi and I can connect, disconnect, reconnect... no problem.

From what I understand you do something like. on the linux side:

aconnect mydevice rtpport:0
# works
aconnect -d mydevice rtpport:0
aconnect mydevice rtpport:0
# do not work

Where mydevice is whatever is to be sent, rtpport:0 is the Network of the rtpmidid server, so it can be imported on the other side. I also tried with a rtpport:1, so it goes straight to an exported port on the other side, same effect on me.

Correct me if I'm (hopefully) wrong.

Anyway, again, network dumps will be very useful. I just did a rule on the Makefile: make dump should just create dump file.

@Rippert
Copy link
Author

Rippert commented Jun 7, 2020

I have been using command line utilties caled sendmidi and receivemidi instead of aconnect, as they automate the connection and allow one to send and receive MIDI messages from the command line. Also I typically connect to the rtpmidi port that is automatically setup by rtpmidid when it detects the Mac running OSX network MIDI. This port is typically called net1 over Bonjour.

receivemidi dev net1
# works
^c
receivemidi dev net1
# does not work

I have also tried connecting to the Network port, with identical results. I'm pretty sure that this is identical to your example as the receivemidi command is using the same ALSA library to connect that aconnect does. I will try it your way when I get a chance. It may be a day or two, as I'm away from my RPi setup right now.

I assume that the make dump command is just the same as the make run command, but creates a tcpdump file in the working directory?

@Rippert
Copy link
Author

Rippert commented Jun 9, 2020

Here is a run with your latest commit. Same test procedure as in my comment above. The out put from the daemon is below and the dump from your make dump command is attached.

make run 
mkdir -p build
cd build &&	cmake .. -DCMAKE_BUILD_TYPE=Release
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/src/rtpmidid/build
cd build && make -j
make[1]: Entering directory '/home/pi/src/rtpmidid/build'
make[2]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
[ 45%] Built target rtpmididlib
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
[ 70%] Built target test_rtppeer
[ 70%] Built target test_mdns
[ 83%] Built target test_rtpserver
[100%] Built target rtpmidid
make[2]: Leaving directory '/home/pi/src/rtpmidid/build'
make[1]: Leaving directory '/home/pi/src/rtpmidid/build'
build/src/rtpmidid --port 10000
[2020-06-09T20:28:47Z] [main.cpp:58] Real Time Protocol Music Instrument Digital Interface Daemon - 20.04.5
[2020-06-09T20:28:47Z] [main.cpp:59] (C) 2019 David Moreno Montero <dmoreno@coralbits.com>
[2020-06-09T20:28:47Z] [mdns_rtpmidi.cpp:89] watch_new 5 1
[2020-06-09T20:28:47Z] [rtpserver.cpp:63] Try listen at :::10000
[2020-06-09T20:28:47Z] [rtpserver.cpp:89] Control port at :::10000
[2020-06-09T20:28:47Z] [rtpserver.cpp:129] Listening RTP MIDI connections at 0.0.0.0:10000, with name: 'raspberrypi'
[2020-06-09T20:28:47Z] [control_socket.cpp:70] Error Listening to socket at /var/run/rtpmidid/control.sock: Permission denied
[2020-06-09T20:28:47Z] [mdns_rtpmidi.cpp:285] (Browser) NEW: service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-09T20:28:47Z] [mdns_rtpmidi.cpp:285] (Browser) NEW: service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-09T20:28:47Z] [mdns_rtpmidi.cpp:306] (Browser) CACHE_EXHAUSTED
[2020-06-09T20:28:47Z] [mdns_rtpmidi.cpp:306] (Browser) ALL_FOR_NOW
[2020-06-09T20:28:48Z] [mdns_rtpmidi.cpp:236] Discovered service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-09T20:28:48Z] [rtpmidid.cpp:255] New alsa port: 1, connects to host: 10.0.1.13, port: 5004, name: net1
[2020-06-09T20:28:48Z] [mdns_rtpmidi.cpp:236] Discovered service 'net1' of type '_apple-midi._udp' in domain 'local'
[2020-06-09T20:28:48Z] [mdns_rtpmidi.cpp:58] Service '/Client2/EntryGroup1' successfully established
[2020-06-09T20:28:48Z] [mdns_rtpmidi.cpp:285] (Browser) NEW: service 'raspberrypi' of type '_apple-midi._udp' in domain 'local'
[2020-06-09T20:28:48Z] [mdns_rtpmidi.cpp:285] (Browser) NEW: service 'raspberrypi' of type '_apple-midi._udp' in domain 'local'
[2020-06-09T20:28:48Z] [mdns_rtpmidi.cpp:231] Received own announcement
[2020-06-09T20:28:48Z] [mdns_rtpmidi.cpp:231] Received own announcement
[2020-06-09T20:29:42Z] [aseq.cpp:123] New ALSA connection from port sendmidi-net1 (129:0)
[2020-06-09T20:29:42Z] [rtpmidid.cpp:260] Callback on subscribe at rtpmidid: sendmidi-net1
[2020-06-09T20:29:42Z] [rtpclient.cpp:78] Try connect to service at 10.0.1.13:5004
[2020-06-09T20:29:42Z] [rtpclient.cpp:100] Try connect to resolved name: TedsAir.local.nat:5004
[2020-06-09T20:29:42Z] [rtpclient.cpp:119] Connected to resolved name: TedsAir.local.nat:5004
[2020-06-09T20:29:42Z] [rtpclient.cpp:128] Control port, local: 37315, remote at TedsAir.local.nat:5004
[2020-06-09T20:29:42Z] [rtpclient.cpp:157] MIDI PORT at port 37315
[2020-06-09T20:29:42Z] [rtpclient.cpp:183] Connecting control port 37315 to TedsAir.local.nat:5004
[2020-06-09T20:29:42Z] [rtppeer.cpp:155] Got confirmation from net1, initiator_id: 2130446554 (true) ssrc: 1323111848, name: net1, port: Control
[2020-06-09T20:29:42Z] [rtpclient.cpp:190] Connecting midi port 37316 to 10.0.1.13:5005
[2020-06-09T20:29:42Z] [rtppeer.cpp:155] Got confirmation from net1, initiator_id: 2130446554 (true) ssrc: 1323111848, name: net1, port: MIDI
[2020-06-09T20:29:42Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-09T20:29:42Z] [rtppeer.cpp:289] Latency net1: 1.30 ms (client / 2)
[2020-06-09T20:29:44Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-09T20:29:44Z] [rtppeer.cpp:289] Latency net1: 332.30 ms (client / 2)
[2020-06-09T20:29:44Z] [rtppeer.cpp:298] Latency net1: 1.10 ms (server / 3)
[2020-06-09T20:29:46Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-09T20:29:46Z] [rtppeer.cpp:289] Latency net1: 1.40 ms (client / 2)
[2020-06-09T20:29:46Z] [rtppeer.cpp:298] Latency net1: 1.20 ms (server / 3)
[2020-06-09T20:29:47Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-09T20:29:47Z] [rtppeer.cpp:289] Latency net1: 371.50 ms (client / 2)
[2020-06-09T20:29:49Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-09T20:29:49Z] [rtppeer.cpp:289] Latency net1: 342.60 ms (client / 2)
[2020-06-09T20:29:54Z] [rtppeer.cpp:370] Got feedback until package 5719 / 5719. No journal, so ignoring.
[2020-06-09T20:29:59Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-09T20:29:59Z] [rtppeer.cpp:289] Latency net1: 132.70 ms (client / 2)
[2020-06-09T20:30:04Z] [rtppeer.cpp:370] Got feedback until package 5720 / 5720. No journal, so ignoring.
[2020-06-09T20:30:07Z] [rtpmidid.cpp:265] Callback on unsubscribe at rtpmidid
[2020-06-09T20:30:07Z] [rtpmidid.cpp:329] Disconnect signal: 3
[2020-06-09T20:30:07Z] [rtppeer.cpp:51] ~rtppeer 'raspberrypi/sendmidi-net1' (local) <-> 'net1' (remote)
[2020-06-09T20:30:07Z] [aseq.cpp:131] Disconnected
[2020-06-09T20:30:16Z] [aseq.cpp:123] New ALSA connection from port sendmidi-net1 (129:0)
[2020-06-09T20:30:16Z] [rtpmidid.cpp:260] Callback on subscribe at rtpmidid: sendmidi-net1
[2020-06-09T20:30:16Z] [rtpclient.cpp:78] Try connect to service at 10.0.1.13:5004
[2020-06-09T20:30:16Z] [rtpclient.cpp:100] Try connect to resolved name: TedsAir.local.nat:5004
[2020-06-09T20:30:16Z] [rtpclient.cpp:119] Connected to resolved name: TedsAir.local.nat:5004
[2020-06-09T20:30:16Z] [rtpclient.cpp:128] Control port, local: 52293, remote at TedsAir.local.nat:5004
[2020-06-09T20:30:16Z] [rtpclient.cpp:157] MIDI PORT at port 52293
[2020-06-09T20:30:16Z] [rtpclient.cpp:183] Connecting control port 52293 to TedsAir.local.nat:5004
[2020-06-09T20:30:16Z] [rtppeer.cpp:155] Got confirmation from net1, initiator_id: 70709857 (true) ssrc: 1323111848, name: net1, port: Control
[2020-06-09T20:30:16Z] [rtpclient.cpp:190] Connecting midi port 52294 to 10.0.1.13:5005
[2020-06-09T20:30:16Z] [rtppeer.cpp:155] Got confirmation from net1, initiator_id: 70709857 (true) ssrc: 1323111848, name: net1, port: MIDI
[2020-06-09T20:30:16Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-09T20:30:16Z] [rtppeer.cpp:289] Latency net1: 1.20 ms (client / 2)
[2020-06-09T20:30:26Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-09T20:30:26Z] [rtppeer.cpp:289] Latency net1: 125.80 ms (client / 2)
[2020-06-09T20:30:26Z] [rtppeer.cpp:298] Latency net1: 1.20 ms (server / 3)
[2020-06-09T20:30:36Z] [rtppeer.cpp:351] Send CK0 to net1
[2020-06-09T20:30:36Z] [rtppeer.cpp:289] Latency net1: 132.90 ms (client / 2)
[2020-06-09T20:30:36Z] [rtppeer.cpp:298] Latency net1: 1.20 ms (server / 3)
[2020-06-09T20:30:42Z] [rtpmidid.cpp:265] Callback on unsubscribe at rtpmidid
[2020-06-09T20:30:42Z] [rtpmidid.cpp:329] Disconnect signal: 3
[2020-06-09T20:30:42Z] [rtppeer.cpp:51] ~rtppeer 'raspberrypi/sendmidi-net1' (local) <-> 'net1' (remote)
[2020-06-09T20:30:42Z] [aseq.cpp:131] Disconnected
^C[2020-06-09T20:30:49Z] [main.cpp:45] SIGINT received. Closing.
[2020-06-09T20:30:49Z] [main.cpp:74] FIN

dump.5004.tar.gz

@Rippert
Copy link
Author

Rippert commented Jun 9, 2020

Tried the same exact test with rtpmidi on Windows instead of the Mac. As you found, it does work after a restart, so something specific to the Mac is the problem. Here are the same data dumps as above, but in the case of a successful test with Windows rtpmidi:

make run
mkdir -p build
cd build &&	cmake .. -DCMAKE_BUILD_TYPE=Release
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/src/rtpmidid/build
cd build && make -j
make[1]: Entering directory '/home/pi/src/rtpmidid/build'
make[2]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
[ 45%] Built target rtpmididlib
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
[ 58%] Built target test_mdns
[ 70%] Built target test_rtppeer
[ 83%] Built target test_rtpserver
[100%] Built target rtpmidid
make[2]: Leaving directory '/home/pi/src/rtpmidid/build'
make[1]: Leaving directory '/home/pi/src/rtpmidid/build'
build/src/rtpmidid --port 10000
[2020-06-09T21:21:55Z] [main.cpp:58] Real Time Protocol Music Instrument Digital Interface Daemon - 20.04.5
[2020-06-09T21:21:55Z] [main.cpp:59] (C) 2019 David Moreno Montero <dmoreno@coralbits.com>
[2020-06-09T21:21:55Z] [mdns_rtpmidi.cpp:89] watch_new 5 1
[2020-06-09T21:21:55Z] [rtpserver.cpp:63] Try listen at :::10000
[2020-06-09T21:21:55Z] [rtpserver.cpp:89] Control port at :::10000
[2020-06-09T21:21:55Z] [rtpserver.cpp:129] Listening RTP MIDI connections at 0.0.0.0:10000, with name: 'raspberrypi'
[2020-06-09T21:21:55Z] [control_socket.cpp:70] Error Listening to socket at /var/run/rtpmidid/control.sock: Permission denied
[2020-06-09T21:21:55Z] [mdns_rtpmidi.cpp:285] (Browser) NEW: service 'DESKTOP-8S0BNE6' of type '_apple-midi._udp' in domain 'local'
[2020-06-09T21:21:55Z] [mdns_rtpmidi.cpp:306] (Browser) CACHE_EXHAUSTED
[2020-06-09T21:21:55Z] [mdns_rtpmidi.cpp:236] Discovered service 'DESKTOP-8S0BNE6' of type '_apple-midi._udp' in domain 'local'
[2020-06-09T21:21:55Z] [rtpmidid.cpp:255] New alsa port: 1, connects to host: 10.0.1.59, port: 5004, name: DESKTOP-8S0BNE6
[2020-06-09T21:21:56Z] [mdns_rtpmidi.cpp:285] (Browser) NEW: service 'raspberrypi' of type '_apple-midi._udp' in domain 'local'
[2020-06-09T21:21:56Z] [mdns_rtpmidi.cpp:285] (Browser) NEW: service 'raspberrypi' of type '_apple-midi._udp' in domain 'local'
[2020-06-09T21:21:56Z] [mdns_rtpmidi.cpp:58] Service '/Client4/EntryGroup1' successfully established
[2020-06-09T21:21:56Z] [mdns_rtpmidi.cpp:231] Received own announcement
[2020-06-09T21:21:56Z] [mdns_rtpmidi.cpp:231] Received own announcement
[2020-06-09T21:21:56Z] [mdns_rtpmidi.cpp:306] (Browser) ALL_FOR_NOW
[2020-06-09T21:22:33Z] [aseq.cpp:123] New ALSA connection from port sendmidi-DESKTOP-8S0BNE6 (129:0)
[2020-06-09T21:22:33Z] [rtpmidid.cpp:260] Callback on subscribe at rtpmidid: sendmidi-DESKTOP-8S0BNE6
[2020-06-09T21:22:33Z] [rtpclient.cpp:78] Try connect to service at 10.0.1.59:5004
[2020-06-09T21:22:33Z] [rtpclient.cpp:100] Try connect to resolved name: DESKTOP-8S0BNE6.local.nat:5004
[2020-06-09T21:22:33Z] [rtpclient.cpp:119] Connected to resolved name: DESKTOP-8S0BNE6.local.nat:5004
[2020-06-09T21:22:33Z] [rtpclient.cpp:128] Control port, local: 45838, remote at DESKTOP-8S0BNE6.local.nat:5004
[2020-06-09T21:22:33Z] [rtpclient.cpp:157] MIDI PORT at port 45838
[2020-06-09T21:22:33Z] [rtpclient.cpp:183] Connecting control port 45838 to DESKTOP-8S0BNE6.local.nat:5004
[2020-06-09T21:22:33Z] [rtppeer.cpp:155] Got confirmation from DESKTOP-8S0BNE6, initiator_id: 1794314077 (true) ssrc: 2050553395, name: DESKTOP-8S0BNE6, port: Control
[2020-06-09T21:22:33Z] [rtpclient.cpp:190] Connecting midi port 45839 to 10.0.1.59:5005
[2020-06-09T21:22:33Z] [rtppeer.cpp:155] Got confirmation from DESKTOP-8S0BNE6, initiator_id: 1794314077 (true) ssrc: 2050553395, name: DESKTOP-8S0BNE6, port: MIDI
[2020-06-09T21:22:33Z] [rtppeer.cpp:351] Send CK0 to DESKTOP-8S0BNE6
[2020-06-09T21:22:33Z] [rtppeer.cpp:289] Latency DESKTOP-8S0BNE6: 1.30 ms (client / 2)
[2020-06-09T21:22:34Z] [rtppeer.cpp:351] Send CK0 to DESKTOP-8S0BNE6
[2020-06-09T21:22:34Z] [rtppeer.cpp:289] Latency DESKTOP-8S0BNE6: 1.60 ms (client / 2)
[2020-06-09T21:22:36Z] [rtppeer.cpp:351] Send CK0 to DESKTOP-8S0BNE6
[2020-06-09T21:22:36Z] [rtppeer.cpp:289] Latency DESKTOP-8S0BNE6: 1.50 ms (client / 2)
[2020-06-09T21:22:37Z] [rtppeer.cpp:351] Send CK0 to DESKTOP-8S0BNE6
[2020-06-09T21:22:37Z] [rtppeer.cpp:289] Latency DESKTOP-8S0BNE6: 1.50 ms (client / 2)
[2020-06-09T21:22:39Z] [rtppeer.cpp:351] Send CK0 to DESKTOP-8S0BNE6
[2020-06-09T21:22:39Z] [rtppeer.cpp:289] Latency DESKTOP-8S0BNE6: 15.30 ms (client / 2)
[2020-06-09T21:22:41Z] [rtppeer.cpp:351] Send CK0 to DESKTOP-8S0BNE6
[2020-06-09T21:22:41Z] [rtppeer.cpp:289] Latency DESKTOP-8S0BNE6: 1.50 ms (client / 2)
[2020-06-09T21:22:42Z] [rtppeer.cpp:351] Send CK0 to DESKTOP-8S0BNE6
[2020-06-09T21:22:42Z] [rtppeer.cpp:289] Latency DESKTOP-8S0BNE6: 94.50 ms (client / 2)
[2020-06-09T21:22:52Z] [rtppeer.cpp:370] Got feedback until package 55983 / 55983. No journal, so ignoring.
[2020-06-09T21:22:52Z] [rtppeer.cpp:351] Send CK0 to DESKTOP-8S0BNE6
[2020-06-09T21:22:52Z] [rtppeer.cpp:289] Latency DESKTOP-8S0BNE6: 111.40 ms (client / 2)
[2020-06-09T21:22:58Z] [rtppeer.cpp:370] Got feedback until package 55984 / 55984. No journal, so ignoring.
[2020-06-09T21:23:02Z] [rtppeer.cpp:351] Send CK0 to DESKTOP-8S0BNE6
[2020-06-09T21:23:02Z] [rtppeer.cpp:289] Latency DESKTOP-8S0BNE6: 133.90 ms (client / 2)
[2020-06-09T21:23:05Z] [rtpmidid.cpp:265] Callback on unsubscribe at rtpmidid
[2020-06-09T21:23:05Z] [rtpmidid.cpp:329] Disconnect signal: 3
[2020-06-09T21:23:05Z] [rtppeer.cpp:51] ~rtppeer 'raspberrypi/sendmidi-DESKTOP-8S0BNE6' (local) <-> 'DESKTOP-8S0BNE6' (remote)
[2020-06-09T21:23:05Z] [aseq.cpp:131] Disconnected
[2020-06-09T21:23:16Z] [aseq.cpp:123] New ALSA connection from port sendmidi-DESKTOP-8S0BNE6 (129:0)
[2020-06-09T21:23:16Z] [rtpmidid.cpp:260] Callback on subscribe at rtpmidid: sendmidi-DESKTOP-8S0BNE6
[2020-06-09T21:23:16Z] [rtpclient.cpp:78] Try connect to service at 10.0.1.59:5004
[2020-06-09T21:23:16Z] [rtpclient.cpp:100] Try connect to resolved name: DESKTOP-8S0BNE6.local.nat:5004
[2020-06-09T21:23:16Z] [rtpclient.cpp:119] Connected to resolved name: DESKTOP-8S0BNE6.local.nat:5004
[2020-06-09T21:23:16Z] [rtpclient.cpp:128] Control port, local: 42728, remote at DESKTOP-8S0BNE6.local.nat:5004
[2020-06-09T21:23:16Z] [rtpclient.cpp:157] MIDI PORT at port 42728
[2020-06-09T21:23:16Z] [rtpclient.cpp:183] Connecting control port 42728 to DESKTOP-8S0BNE6.local.nat:5004
[2020-06-09T21:23:16Z] [rtppeer.cpp:155] Got confirmation from DESKTOP-8S0BNE6, initiator_id: 1126249249 (true) ssrc: 2050553395, name: DESKTOP-8S0BNE6, port: Control
[2020-06-09T21:23:16Z] [rtpclient.cpp:190] Connecting midi port 42729 to 10.0.1.59:5005
[2020-06-09T21:23:16Z] [rtppeer.cpp:155] Got confirmation from DESKTOP-8S0BNE6, initiator_id: 1126249249 (true) ssrc: 2050553395, name: DESKTOP-8S0BNE6, port: MIDI
[2020-06-09T21:23:16Z] [rtppeer.cpp:351] Send CK0 to DESKTOP-8S0BNE6
[2020-06-09T21:23:16Z] [rtppeer.cpp:289] Latency DESKTOP-8S0BNE6: 1.30 ms (client / 2)
[2020-06-09T21:23:26Z] [rtppeer.cpp:351] Send CK0 to DESKTOP-8S0BNE6
[2020-06-09T21:23:26Z] [rtppeer.cpp:289] Latency DESKTOP-8S0BNE6: 2.00 ms (client / 2)
[2020-06-09T21:23:33Z] [rtppeer.cpp:370] Got feedback until package 38186 / 38186. No journal, so ignoring.
[2020-06-09T21:23:36Z] [rtppeer.cpp:351] Send CK0 to DESKTOP-8S0BNE6
[2020-06-09T21:23:36Z] [rtppeer.cpp:289] Latency DESKTOP-8S0BNE6: 1.70 ms (client / 2)
[2020-06-09T21:23:44Z] [rtppeer.cpp:370] Got feedback until package 38187 / 38187. No journal, so ignoring.
[2020-06-09T21:23:46Z] [rtppeer.cpp:351] Send CK0 to DESKTOP-8S0BNE6
[2020-06-09T21:23:47Z] [rtppeer.cpp:289] Latency DESKTOP-8S0BNE6: 389.90 ms (client / 2)
[2020-06-09T21:23:51Z] [rtpmidid.cpp:265] Callback on unsubscribe at rtpmidid
[2020-06-09T21:23:51Z] [rtpmidid.cpp:329] Disconnect signal: 3
[2020-06-09T21:23:51Z] [rtppeer.cpp:51] ~rtppeer 'raspberrypi/sendmidi-DESKTOP-8S0BNE6' (local) <-> 'DESKTOP-8S0BNE6' (remote)
[2020-06-09T21:23:51Z] [aseq.cpp:131] Disconnected
[2020-06-09T21:23:56Z] [mdns_rtpmidi.cpp:299] (Browser) REMOVE: service 'DESKTOP-8S0BNE6' of type '_apple-midi._udp' in domain 'local'
[2020-06-09T21:23:56Z] [rtpmidid.cpp:280] Removing rtp midi client DESKTOP-8S0BNE6
[2020-06-09T21:23:56Z] [rtpmidid.cpp:287] Found client to delete: alsa port 1. Deletes all known addreses.
[2020-06-09T21:23:56Z] [rtpmidid.cpp:544] Removing peer from known peers list. Port 1
^C[2020-06-09T21:24:01Z] [main.cpp:45] SIGINT received. Closing.
[2020-06-09T21:24:01Z] [main.cpp:74] FIN

windump.5004.tar.gz

@Rippert
Copy link
Author

Rippert commented Jun 9, 2020

Also tested it connecting from rtpmidi on Windows to the Mac. It does work after a disconnect and reconnect. So something specific to rtpmidid and how it interacts with the Mac Network Midi implementation.

@davidmoreno
Copy link
Owner

I would need the dump of the windows to mac interaction, to check whats different.

The only thing I can think of is that rtpmidid is very liberal on which ports, and communication ids to use. Maybe it should be more strict and always use the same.... But with a win -> mac I will know better.

If you restart rtpmidid, does it start working again? (it should be the same... if it does there might be some tip there).

@Rippert
Copy link
Author

Rippert commented Jun 10, 2020

Yes, restarting rtpmidid does start it working again, but only for the first connection. It will still fail if I disconnect and reconnect.

I'll do a data capture using the Windows to Mac setup later today.

@davidmoreno
Copy link
Owner

If you dont mind, can run it through valgrind?

Maybe there is some mem problem somewhere? (make valgrind).

@Rippert
Copy link
Author

Rippert commented Jun 10, 2020

make valgrind doesn't work:

make valgrind
make: *** No rule to make target 'valgrind'.  Stop.

There is a make run-valgrind, but it gives an error:

make run-valgrind
mkdir -p build
cd build &&	cmake .. -DCMAKE_BUILD_TYPE=Release
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/src/rtpmidid/build
cd build && make -j
make[1]: Entering directory '/home/pi/src/rtpmidid/build'
make[2]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
[ 45%] Built target rtpmididlib
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Entering directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
make[3]: Leaving directory '/home/pi/src/rtpmidid/build'
[ 62%] Built target rtpmidid
[ 75%] Built target test_rtpserver
[ 87%] Built target test_rtppeer
[100%] Built target test_mdns
make[2]: Leaving directory '/home/pi/src/rtpmidid/build'
make[1]: Leaving directory '/home/pi/src/rtpmidid/build'
valgrind --leak-check=full --show-leak-kinds=all build/src/rtpmidid --port 10000
valgrind: Bad option: --show-leak-kinds=all
valgrind: Use --help for more information or consult the user manual.
make: *** [Makefile:41: run-valgrind] Error 1
valgrind --version
valgrind-3.7.0

@davidmoreno
Copy link
Owner

Hi, I think I just fixed this issue, can you check?

It is fixed at commit 250162c.

I could get a handle on an iPad and try to reproduce and found a problem with the iPad, which I think it is the same you were
having.

The problem was that when the other end disconnects I was assuming the other end do not want
to talk to us again and forgetting about it. I added the cli command update-mdns that forces mdns reannouncement of all
parties, and the remote end connection reappeared and could be used.

So now instead of forgetting about the other party, I disconnect all alsa connections (to signal the error) and reset the peer
information so that new connection attempts will just create a new connection.

Can you check if it works now?

If it does, I will close this issue, and quite probably release a new release with Mac OS and iPad support.

@Rippert
Copy link
Author

Rippert commented Jul 6, 2020 via email

@Rippert
Copy link
Author

Rippert commented Jul 9, 2020

I can confirm that it does work now. I can disconnect and reconnect from the Raspberry pi to the Mac repeatedly.

It takes about 30 seconds to reconnect, which is a little slower than Mac to Mac connections, but perfectly acceptable. I've included the output from the daemon during a reconnect. The MIDI data starts to flow after the Latency net1: 1.20 ms (server / 3) messages stop. Again, I don't think this is a bug, just some info for you.

Thanks again,
Ted

[2020-07-09T19:49:19Z] [aseq.cpp:131] Disconnected
[2020-07-09T19:49:24Z] [aseq.cpp:123] New ALSA connection from port receivemidi-net1 (129:0)
[2020-07-09T19:49:24Z] [rtpmidid.cpp:261] Callback on subscribe at rtpmidid: receivemidi-net1
[2020-07-09T19:49:24Z] [rtpclient.cpp:78] Try connect to service at 10.0.1.13:5004
[2020-07-09T19:49:24Z] [rtpclient.cpp:100] Try connect to resolved name: TedsAir.local.nat:5004
[2020-07-09T19:49:24Z] [rtpclient.cpp:119] Connected to resolved name: TedsAir.local.nat:5004
[2020-07-09T19:49:24Z] [rtpclient.cpp:128] Control port, local: 58213, remote at TedsAir.local.nat:5004
[2020-07-09T19:49:24Z] [rtpclient.cpp:157] MIDI PORT at port 58213
[2020-07-09T19:49:24Z] [rtpclient.cpp:183] Connecting control port 58213 to TedsAir.local.nat:5004
[2020-07-09T19:49:24Z] [rtppeer.cpp:154] Got confirmation from net1, initiator_id: 376414137 (true) ssrc: 3344945440, name: net1, port: Control
[2020-07-09T19:49:24Z] [rtpclient.cpp:190] Connecting midi port 58214 to 10.0.1.13:5005
[2020-07-09T19:49:24Z] [rtppeer.cpp:154] Got confirmation from net1, initiator_id: 376414137 (true) ssrc: 3344945440, name: net1, port: MIDI
[2020-07-09T19:49:24Z] [rtppeer.cpp:349] Send CK0 to net1
[2020-07-09T19:49:24Z] [rtppeer.cpp:288] Latency net1: 1.20 ms (client / 2)
[2020-07-09T19:49:34Z] [rtppeer.cpp:349] Send CK0 to net1
[2020-07-09T19:49:34Z] [rtppeer.cpp:288] Latency net1: 125.70 ms (client / 2)
[2020-07-09T19:49:34Z] [rtppeer.cpp:296] Latency net1: 1.20 ms (server / 3)
[2020-07-09T19:49:44Z] [rtppeer.cpp:349] Send CK0 to net1
[2020-07-09T19:49:44Z] [rtppeer.cpp:288] Latency net1: 125.80 ms (client / 2)
[2020-07-09T19:49:44Z] [rtppeer.cpp:296] Latency net1: 1.20 ms (server / 3)
[2020-07-09T19:49:54Z] [rtppeer.cpp:349] Send CK0 to net1
[2020-07-09T19:49:54Z] [rtppeer.cpp:288] Latency net1: 126.00 ms (client / 2)
[2020-07-09T19:50:04Z] [rtppeer.cpp:349] Send CK0 to net1
[2020-07-09T19:50:05Z] [rtppeer.cpp:288] Latency net1: 130.80 ms (client / 2)
[2020-07-09T19:50:15Z] [rtppeer.cpp:349] Send CK0 to net1
[2020-07-09T19:50:15Z] [rtppeer.cpp:288] Latency net1: 129.50 ms (client / 2)
[2020-07-09T19:50:20Z] [rtpmidid.cpp:266] Callback on unsubscribe at rtpmidid
[2020-07-09T19:50:20Z] [rtpmidid.cpp:325] Disconnect signal: 3
[2020-07-09T19:50:20Z] [rtppeer.cpp:50] ~rtppeer 'raspberrypi/receivemidi-net1' (local) <-> 'net1' (remote)
[2020-07-09T19:50:20Z] [aseq.cpp:131] Disconnected

@davidmoreno
Copy link
Owner

Thanks!

I will close this issue and add the 30 seconds problem as another issue.

Quite probably I will do a release this weekend with precompiled .deb packages for raspberry pi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants