colinbdclark / osc.js

An Open Sound Control (OSC) library for JavaScript that works in both the browser and Node.js
GNU General Public License v2.0
774 stars 117 forks source link

Port/ip confusion #173

Closed quintendewilde closed 4 years ago

quintendewilde commented 4 years ago

Hi, In the code below.

When I have 1 computer in my local network with the ip of 192.168.1.3 and I'm sending from another.

Which one do I need to fill in?

const udpPort = new osc.UDPPort({ // This is the port we're listening on. localAddress: "127.0.0.1", localPort: 4600,

// This is where Sonic PI is listening for OSC messages.
remoteAddress: "192.168.1.3",
remotePort: 4560,

});

The bottom one right? Do I even need the top part if I'm only sending OSC Messages? I need make sure this is correct before checking what's causing my message to not appear on my machine

quintendewilde commented 4 years ago

Hi, In the code below.

When I have 1 computer in my local network with the ip of 192.168.1.3 and I'm sending from another.

Which one do I need to fill in?

const udpPort = new osc.UDPPort({ // This is the port we're listening on. localAddress: "127.0.0.1", localPort: 4600,

// This is where Sonic PI is listening for OSC messages.
remoteAddress: "192.168.1.3",
remotePort: 4560,

});

The bottom one right? Do I even need the top part if I'm only sending OSC Messages? I need make sure this is correct before checking what's causing my message to not appear on my machine

I get this error when I run my script.

`events.js:292 throw er; // Unhandled 'error' event ^

Error: send EADDRNOTAVAIL 192.168.1.3:4560 at doSend (dgram.js:683:16) at defaultTriggerAsyncIdScope (internal/async_hooks.js:323:12) at afterDns (dgram.js:629:5) at processTicksAndRejections (internal/process/task_queues.js:85:21) Emitted 'error' event on instance at: at /Users/quinten/Tools-for-Instagram/node_modules/osc/src/platforms/osc-node.js:126:22 at processTicksAndRejections (internal/process/task_queues.js:83:21) { errno: 'EADDRNOTAVAIL', code: 'EADDRNOTAVAIL', syscall: 'send', address: '192.168.1.3', port: 4560 }`

I did the lsof thing and got nothing. So the port is not being used on the machine.

colinbdclark commented 4 years ago

Hi @quintendewilde. Based on your error message (EADDRNOTAVAIL), it sounds like that remote IP address (192.168.1.3) and/or port (4560) isn't available to the computer running osc.js, which is trying to connect to Sonic Pi. Can you verify that it is indeed available and listening on that port, and reachable across the network?

As for your other question, you don't need to specify a local address and port if the defaults are appropriate to your computer, but osc.UDPPort will bind a socket to that address and port in case you also want to receiving messages, so you should choose a free port if the default, 57121, is already used. But it's clear from the message that your error is related to trying to connect to the remote computer.

quintendewilde commented 4 years ago

` // This is the port we're listening on. localAddress: "127.0.0.1", localPort: 4600,

// This is where Sonic PI is listening for OSC messages.
remoteAddress: "127.0.0.1",
remotePort: 4560,`

First one is the incoming and the second one outgoing. => correct?

I'm receiving this in my sonic pi cue log:

Screenshot 2020-09-26 at 14 53 20
colinbdclark commented 4 years ago

Yes, the "local" address and port are for receiving messages via an osc.UDPPort, while "remote" is used for outgoing messages.

Based on your screenshot, it looks like you're successfully receiving messages to your Sonic Pi machine, congratulations!