PDA

View Full Version : Q: IP addresses and ports


DarkStar
09-18-2016, 01:36 AM
I have no idea about IP addresses and ports (as used in oscii-bot scripts, and generally). Can someone explain them clearly?

I understand that oscii-bot needs to communicate with Reaper and with the MIDI control surface, in and out. So it needs 4 connections.

I see these examples in sample_script.txt
// @input devicenameforcode MIDI "substring match" [skip]
// @input devicenameforcode OSC "*:9000"
// @input devicenameforcode OSC "192.168.1.2:9000"
@input r24 MIDI "ZOOM R"
// @output devicenameforcode OSC "127.0.0.1:8000" [maxpacketsize] [sleepamt]
// @output devicenameforcode MIDI "substring match" [skip]
@output localhost OSC "127.0.0.1:8000"

And, from other scripts:
@input osc_in OSC "*:9000"
@output osc_out OSC "localhost:8000"
@output midi_out MIDI "AlphaTrack"
@input midi_in MIDI "AlphaTrack"

@input in MIDI "Mix"
@input OSC_IN OSC "localhost:9000"
@output OSC_to_REAPER OSC "192.168.0.10:8000" 0 0
@output out MIDI "Mix"

So the four types are:
@input ... MIDI,
@output ... OSC,
@input ... OSC and
@output ... MIDI.
And the MIDI lines reference the MIDI device name, as seen in the Control Surface definition (is that right?).

Now, for the @input ... OSC:
-- the first item is some unique name, for use within the script
-- the IP address is sometimes '*', or 'localhost' or '192.168.1.2'
-- what do those 3 mean?
-- what's the difference?
-- the port number is (always?) 9000; why is that number used?
-- how do I know that nothing-else is using it?

And for the @output ... OSC:
-- the first item is some unique name, for use within the script
-- the IP address is sometimes or 'localhost' or '127.0.0.1 or '192.168.0.10'
-- what do those 3 mean?
-- what's the difference?
-- the port number is (always?) 8000; why is that number used?
-- how do I know that nothing-else is using it?

-- why don't the 2 OSC lines use the same IP address?

goldenarpharazon
09-20-2016, 06:07 PM
I have no idea about IP addresses and ports (as used in oscii-bot scripts, and generally). Can someone explain them clearly?

The IP address and port associate a network path for data to pass between Reaper to and from OSCII-Bot, and to and from OSCII-Bot and the Midi device. In practice this network path is likely to be all internal within the computer (workstation/laptop etc) that runs Reaper which perhaps makes it a little confusing: although passed using the IP network protocol, the data is just handed on between programmes within the computer rather than going over any external network.


The IP Address and port corresponds to part of the key network protocol defining the internet. The IP address identifies a unique network end point [like 23 Acacia Gardens, Anytown] whereas the port identifies a sub-classification of letter boxes at house addresses [e.g. one for newspapers, one for junk circulars, one for personal mail] - this https://technet.microsoft.com/en-us/library/cc958829.aspx whilst quite technical might be helpful to explain IP addresses and this https://en.wikipedia.org/wiki/Port_(computer_networking) explains ports


<snip>

And the MIDI lines reference the MIDI device name, as seen in the Control Surface definition (is that right?)

Yes almost. It needs to match, or be a substring of, the appropriate Midi device name in preferences, Audio, Midi Device settings.


Now, for the @input ... OSC:
-- the first item is some unique name, for use within the script
Yes

-- the IP address is sometimes '*', or 'localhost' or '192.168.1.2'
-- what do those 3 mean?
-- what's the difference?
* means listen on any IP address as a wildcard
localhost is a standard name used to identify "this local computer" as a loopback - see https://en.wikipedia.org/wiki/Localhost
192.168.1.2 is a specific Class C IP address that happens to be allocated to this computer

-- the port number is (always?) 9000; why is that number used?
-- how do I know that nothing-else is using it?
9000 and 8000 are Reaper OSC default ports borrowed (probably) from the fairly common "TouchOSC" device's implementation. One can change them from defaults if wished in the control surface settings. You don't "know" that nothing else is using the port but it won't matter since the port is being used to communicate solely between 2 end points and isn't in the reserved range below 1024 - see https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
Use the defaults unless you have a specific external control surface device that can't be changed (unlikely) or are part of a complex network (unlikely in personal music making)


And for the @output ... OSC:
-- the first item is some unique name, for use within the script
-- the IP address is sometimes or 'localhost' or '127.0.0.1 or '192.168.0.10'
-- what do those 3 mean?
-- what's the difference?
-- the port number is (always?) 8000; why is that number used?
-- how do I know that nothing-else is using it?

-- why don't the 2 OSC lines use the same IP address?
localhost and 127.0.0.1 are synonyms (i.e. name is equivalent to number)
192.168.0.10 is a different class C address uniquely allocated to another computer on another network. The examples asked about are from different setups running on different computers/networks so the unique IP address will be different.

DarkStar
09-23-2016, 06:51 AM
Thank you for the explanations - now I just need to think them through.

PS - I've just got an Akai MIDImix :) and am very grateful for your MIDImix oscii-bot script. When I'm brave / knowledgeable enough I'll have a look at some ideas I have for that script too. ;) Meanwhile, I'm working on this at the moment:

http://i.imgur.com/lrzDUHot.png >>> http://i.imgur.com/lrzDUHo.png

DarkStar
09-23-2016, 10:04 AM
OK, so if oscii-bot and Reaper are on the same system, I think I can use 'localhost' for both the OSC input and output.

That sounds better than using '192.168... ' as the latter could be spotted by the Firewall software and possibly blocked. That is, if 'localhost' is not picked up by the Firewall.

DarkStar
11-22-2019, 07:25 AM
Just to check:

This week I changed my Internet Service provider and use a new router. The OSC comms between my AKAI MIDIMix and Reaper no longer work and I think that my IP address must have changed.

When I run ipconfig /all in a Windows/CMD window, I see that the IP address listed for Ethernet is: 192.168.1.64 and that same address is displayed in Reaper's / Control Surface Settings for "Local IP".

Is that the number I need to use in the oscii-bot .txt file, in the line
@output OSC_to_REAPER OSC "192.168.1.2:8000" 0 0

I want to double-check as when I tried it last night somehow I managed to disconnect from the Internet and leave my router in an error state. Mercifully all is OK today.

goldenarpharazon
11-23-2019, 09:57 AM
Yes. 192.168.1.64 will be correct to use.

Your new router has dynamically allocated this different address.
If you wish you can login to the new router and tell it to permanently associate this IP address (or any other chosen from the 192.168.1.n range) to the MAC address of your Reaper PC. Then the IP address will never change whilst you use your Reaper PC on the network of this router.

DarkStar
11-24-2019, 07:07 AM
Thank you - it works OK; I got a bit concerned when i managed to mess up the router.

And I was slightly surprised that a broadband router can give a computer an IP address, rather than be told what the computer's IP address is.

Plentos
12-23-2019, 05:43 AM
I have no idea about IP addresses and ports (as used in oscii-bot scripts, and generally). Can someone explain them clearly?

I understand that oscii-bot needs to communicate with Reaper and with the MIDI control surface, in and out. So it needs 4 connections.

I see these examples in sample_script.txt
// @input devicenameforcode MIDI "substring match" [skip]
// @input devicenameforcode OSC "*:9000"
// @input devicenameforcode OSC "192.168.1.2:9000"
@input r24 MIDI "ZOOM R"
// @output devicenameforcode OSC "127.0.0.1:8000" [maxpacketsize] [sleepamt]
// @output devicenameforcode MIDI "substring match" [skip]
@output localhost OSC "127.0.0.1:8000"

And, from other scripts:
@input osc_in OSC "*:9000"
@output osc_out OSC "localhost:8000"
@output midi_out MIDI "AlphaTrack"
@input midi_in MIDI "AlphaTrack"

@input in MIDI "Mix"
@input OSC_IN OSC "localhost:9000"
@output OSC_to_REAPER OSC "192.168.0.10:8000" 0 0
@output out MIDI "Mix"

So the four types are:
@input ... MIDI,
@output ... OSC,
@input ... OSC and
@output ... MIDI.
And the MIDI lines reference the MIDI device name, as seen in the Control Surface definition (is that right?).

Now, for the @input ... OSC:
-- the first item is some unique name, for use within the script
-- the IP address is sometimes '*', or 'localhost' or '192.168.1.2'
-- what do those 3 mean?
-- what's the difference?
-- the port number is (always?) 9000; why is that number used?
-- how do I know that nothing-else is using it?

And for the @output ... OSC:
-- the first item is some unique name, for use within the script
-- the local IP address (https://router-network.com/tools/what-is-my-router-ip) is sometimes or 'localhost' or '127.0.0.1 or '192.168.0.10'
-- what do those 3 mean?
-- what's the difference?
-- the port number is (always?) 8000; why is that number used?
-- how do I know that nothing-else is using it?

-- why don't the 2 OSC lines use the same IP address?

Hello,
I have the same problem as yours

gordon514
06-15-2022, 11:47 PM
The IP address and port associate a network path for data to pass between Reaper to and from OSCII-Bot, and to and from OSCII-Bot and the Midi device. In practice this network path is likely to be all internal within the computer (workstation/laptop etc) that runs Reaper which perhaps makes it a little confusing: although passed using the IP network protocol, the data is just handed on between programmes within the computer rather than going over any external network.


The IP Address and port corresponds to part of the key network protocol defining the internet. The IP address identifies a unique network end point [like 23 Acacia Gardens, Anytown] whereas the port identifies a sub-classification of letter boxes at house addresses [e.g. one for newspapers, one for junk circulars, one for personal mail] - this https://technet.microsoft.com/en-us/library/cc958829.aspx whilst quite technical might be helpful to explain IP addresses and this https://en.wikipedia.org/wiki/Port_(computer_networking) explains ports


<snip>



Yes almost. It needs to match, or be a substring of, the appropriate Midi device name in preferences, Audio, Midi Device settings.


Yes

* means listen on any IP address as a wildcard
localhost is a standard name used to identify "this local computer" as a loopback - see https://192-168-0-1.us
192.168.1.2 is a specific Class C IP address that happens to be allocated to this computer

9000 and 8000 are Reaper OSC default ports borrowed (probably) from the fairly common "TouchOSC" device's implementation. One can change them from defaults if wished in the control surface settings. You don't "know" that nothing else is using the port but it won't matter since the port is being used to communicate solely between 2 end points and isn't in the reserved range below 1024 - see https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
Use the defaults unless you have a specific external control surface device that can't be changed (unlikely) or are part of a complex network (unlikely in personal music making)


localhost and 127.0.0.1 are synonyms (i.e. name is equivalent to number)
192.168.0.10 is a different class C address uniquely allocated to another computer on another network. The examples asked about are from different setups running on different computers/networks so the unique IP address will be different.

You solved my problem, thanks!