Max MSP via internet

Apr 26, 2009 at 8:56pm

Max MSP via internet

Hello guys

I’ve got what i think to be a very basic question, anyway…
i’m trying to communicate via my MaxMSP 5 to another computer via internet, using MaxMSP 5 as well. I’ve used a whole number of objects like mxj (with the net.tcp. class) the netsend/netreceive combination and even jit.net.send and so on. Both me and the other guy at the computer on the other side have opened relevant ports and i’ve got his ip address. which brings me to the question: should i use his EXTERNAL or LOCAL ip ? could this be the cause of the problem?(i’ve tried both, anyway…) ’cause it’s not working and it’s driving me sortof crazy…a big thank you to anyone who could solve the issue.

#43547
Apr 26, 2009 at 11:05pm

http://www.cycling74.com/story/2006/10/23/104657/91

Maybe the section “How do I find out my IP address” could be useful.
J-F.

#156273
Apr 27, 2009 at 9:34am

i created an mxj object named myPublicIp which helps to give you your public IP address necessary for communication over the net. The objects gets the content of a particular website that displays your external IP address.

import com.cycling74.max.*;
import java.io.*;
import java.net.*;

public class myPublicIp extends MaxObject {

private class publicIpGetter extends Thread implements Executable {
String theLine = “test”;

public void run(){

try {
URL u = new URL(“http://myip.dk/“);
int port = 80;
Socket s = new Socket(u.getHost(), port);
OutputStream theOutput = s.getOutputStream();
PrintWriter pw = new PrintWriter(theOutput, true);
// System.out.println(u.getFile());
pw.println(“GET ” + u.getFile() + ” HTTP/1.1″);
pw.println(“Host: myip.dk”);
pw.println(“Connection: Close”);
pw.println();
// read the response
BufferedReader in = new BufferedReader(
new InputStreamReader( s.getInputStream() ));
boolean loop = true;
// StringBuffer sb = new StringBuffer(8096);

while (loop) {
if ( in.ready() ) {
// int i=0;

while ((theLine = in.readLine()) != null) {
theLine =in.readLine();
outlet(0,theLine);
// System.out.println(“cr”);
}
loop = false;
}
// Thread.currentThread().sleep(50);
}

// display the response to the out console
// outlet(0, sb.toString());
s.close();
MaxQelem q = new MaxQelem(this);
q.set();
}
catch (MalformedURLException e) {
post(“http://www.myip.dk” + ” is not a valid URL”);
}
catch (IOException e) {
// post(e);
}
}

public void execute() {
// outlet(0, theLine);
// outlet(0, “test”);

}
}

private static final String[] INLET_ASSIST = new String[]{
“inlet 1 help”
};
private static final String[] OUTLET_ASSIST = new String[]{
“outlet 1 help”
};

public myPublicIp(Atom[] args)
{
declareInlets(new int[]{DataTypes.ALL});
declareOutlets(new int[]{DataTypes.ALL});

setInletAssist(INLET_ASSIST);
setOutletAssist(OUTLET_ASSIST);

}

public void bang()
{
publicIpGetter pig = new publicIpGetter();
pig.start();
}

public void inlet(int i)
{
}

public void inlet(float f)
{
}

public void list(Atom[] list)
{
}

}

Compile the code and use the object inside the following abstraction which does post-processing of the html code. The output will be your external IP address:

– Pasted Max Patch, click to expand. –

I hope this helps,

Georg

#156274
Apr 27, 2009 at 9:46am

OK, just reread the post. It seems you don’t have a problem determining your friend’s IP address. You need to use his public IP address, otherwise the communication won’t work. Opening ports on the router isn’t everything. You also need to make sure that the incoming messages are forwarded to the right computer within the local network (this is called network address translation [NAT] or port forwarding). This is more tricky than you’d think. Sometimes routers just won’t work and need a firmware upgrade. Sometimes I had to put the computer into the DMZ. In any case, the router should be restarted even if the manual says otherwise. I can pride myself for eventually overcoming problems with all router, although this can be a lengthy and frustrating process.

Georg

#156275
Apr 27, 2009 at 3:01pm

Yep, fact is, as u observed, i’m using both mine and my friend’s public ip addresses(btw, thanks for the previous reply). Just to clarify, my friend isn’t part of a local network, but in another place altogether(so we don’t have the same router etc.). I have confirmation that the ports we’re using are open and the addresses correct. can’t understand what could be wrong. i tried doing a small test again, using the netsend/netreceive combination (netsend on my computer, netreceive on his) but to no avail. Hope to fix the thing as soon as possible. Thanks again anyway.

#156276
Apr 27, 2009 at 3:17pm

Why don’t you download my networked multimedia performance environment Quintet.net and see whether you can get it to work. There is also a Wiki that explains how to get started with all of this.

Good luck!!

http://www.quintet-net.org/dl-frames.html
http://www.georghajdu.de/quintet.net/wiki/doku.php

Georg

#156277
Mar 1, 2014 at 5:06pm

I just downloaded quintet.net to test with an installation I am working on involving two moving locations(shipping container/art galleries) that will have wifi hotspots. We just want to send control information from one installation to the other and are trying to gauge if this is possible? I see this is an old feed but any advice would be much appreciated.

#282565
Mar 2, 2014 at 4:14am

Hi SAMFM1163,

this might be an easier solution: I created a mxj class (jm.pubNub)that integrates the a so-called push service (PubNub.com). The bottom line is that you can send messages between Max patches (and any other device with internet connection) over the internet without having to deal with IP-adresses, opening ports in local networks, firewalls and other stuff. Also changing IP-adresses are no problem. Both patches have to “inscribe” to the same “channel” and can communicate with each other independently from their location.

the tool is here: http://cycling74.com/toolbox/jm-pubnub/

The downside is that PubNub.com is not a free free service. But they have a Sandbox option which is free and allows to connect up to 20 different devices (in your case Max patches) per day.

If you want to use it and you run into problems, fell free to contact me.

Best Jan

#282588
Mar 2, 2014 at 11:15pm

Awesome! Thank you. I just spent the weekend learning about port forwarding! This looks like a much better option. Thank you!

Samfm

#282639
Mar 8, 2014 at 2:56am

Just for curiosity, how did you finally solve/approach your installation?

#283174

You must be logged in to reply to this topic.