best way connect two computers for sending openGL and commands

    Nov 12 2012 | 9:56 pm
    Im need to connect two macbook with an ethernet cable and wounder which is the best method.
    I want to:
    :: Computer 1 ::
    with my patch with 3D openGL graphics
    :: Computer 2 ::
    controlling the patch with a controllpanel.
    :: Computer 2 will send to computer 1 ::
    commands like bangs and messages
    :: Computer 1 will send to computer 2 ::
    the stream of the graphic so I can see whats going on
    Which is the best method?
    Ive been looking and reading in the tutorials about UDPsend and receive.
    Ive read:
    "UDP isn’t the most robust protocol: it does not guarantee that packets will arrive in any order, nor does it provide any means of error or packet loss notification. However, it is a high-speed protocol, often used for networked audio and video content, and happens to be easy to coerce into working with Max messages."
    but if I want to make sure everything arrives I should choose TCP
    I also had a look on: send and receive
    which one shall I choose? or UDPsend?
    or anything else?

    • Nov 12 2012 | 10:25 pm
      TCP includes flow control and error correction, but each packet is heavier, that doesn't mean it is every time a problem!
      the fact you use or udpsend is, imho, depending on what you want to send.
      I'd send command through udpsend, and matrix through
      we could also imagine a protocol that could encapsulate/decapsulate everything inside matrices, command & video matrices (that doesn't sound as insane as it looks)
    • Nov 12 2012 | 10:37 pm
      thanks Julien for quick reply!
      but in my case I both want to send messages and the content in a jit.pwindow to see whats going on. shall I use both? guess not ...
      udpsend doesnt send matrix? I want to send the content in my jit.pwindow in computer 1 to computer two to see whats going on
    • Nov 12 2012 | 10:49 pm
      you can process you matrix and, for instance, dedicate one column to all your "currently sent" command.
      like packing/unpacking the matrix before to send/after to receive
      you know what I mean?
    • Nov 12 2012 | 11:03 pm
      sorry not exactly. this kind of communication is new to me. you mean I unpack the matrix and sending it with udp and then packing it again after receiving it.
      so I shall not use if I want to send both messages, bangs and videostream?
      Im currently looking at and are succeding to sending the matrix to jit.recv but I cant figure out how I can send both messages and video.
      I also want to comunicate in two direction at the same time:
      Computer 1 -> computer 2:
      sending whats in my jit.pwindow in computer 1 to computer 2
      computer 2 -> computer 1:
      sending different messages and commands to controll the patch in computer 1
    • Nov 12 2012 | 11:11 pm
      As mentioned above, use for the video matrices and udpsend for your controls. Mixing them is making it unnecessarily complicated.
      Btw, do you really need to send the video back to the control computer? No way to monitor it with an extra display on the video computer? It takes resources to pump these matrices around. Depending on resolution and rendering method you might wanna send a downscaled video to your control computer.
    • Nov 12 2012 | 11:18 pm
      the reason for why I need to send it back is that its for a theatre project and Im fading the matrix away for a part of the show so I cant see whats going on stage. I need to preview my stuff before I start it again for the audience. thats way.
      yes maybe I shall scale it down. Im doing this by putting it into another matrix right. as for example a float32 matrix with less dimensions. correct?
      "use for the video matrices and udpsend for your controls. Mixing them is making it unnecessarily complicated. "
      so I need to use both (for sending the matrix from computer 1 to 2) and UDPsend for sending the controlls from computer 2 to 1?
    • Nov 13 2012 | 10:49 am
      Yes and yes.
      About rendering performance, if you have your graphics pipeline set up efficiently everything is rendered on the GPU with openGL acceleration. Now when you send the video out using you have to copy your matrices from GPU to CPU, for example by sending from to a jit.matrix (or directly to, not sure if it will take it). This can cause a serious rendering performance decrease, ie. frame rate drop. My advice would be to first work out the rendering pipeline without networked monitoring, then add that part and optimize to minimize any negative effects.
      Somewhere above you talk about jit.pwindow. Rendering to jit.pwindow instead of jit.window causes the same effects. Matrices are copied first to CPU instead of being rendered directly by the GPU. For optimal openGL performance, render to jit.window.
      Sorry if all this is already known to you. I'm just pre-emptively stating it given all the Jitter optimization questions in the forum lately...
    • Nov 13 2012 | 11:00 am
      thanks a lot for your input!
      Im rendering the OpenGLgraphics to GPU
      Its just for output the preview videoscreen to computer 2 (thats just on when the main projection that rendered through GPU is turned off)
      so I do like this:
      - scale down the preview stuff by sending through a matrix with less dimensions before sending it with (the preview is only on when the main window rendered through jit.window is turned off)
      - sending the downscaled matrix with to computer 2
      - the main projection thats on computer 1 is rendered to jit.window
      - using UDPsend to send messages and bangs from computer 2 to computer 1
      done! I guess. (havnt tried yet)
    • Nov 13 2012 | 11:25 am
      Sounds good. Maybe scaling down is not necessary though, depends on resolution and frame rate, you'll have to test. Most efficient will be to scale down on the GPU as well, if necessary.
      One thing, what bangs are you sending? Not the rendering qmetro bangs I presume?
    • Nov 13 2012 | 11:29 am
      no not the bangs from qmetro. just bangs to trigger different events through button
      Thanks a lot for your help!!!
    • Nov 13 2012 | 11:57 am
      for sending bangs that trigger events, I'd rather go with [net.tcp.send] and [net.tcp.recv] (both are MXJ objects). This will make it sure that your bangs actually arrive to the destination and won't get dropped while traveling through the network...
    • Nov 13 2012 | 12:01 pm
      Sounds right indeed.
    • Nov 13 2012 | 12:16 pm
      okej. thanks. I go for [net.tcp.send] and [net.tcp.recv] instead of [udpsend] and [udprecv]
      can [net.tcp.send] and [net.tcp.recv] send for example both a matrix and messages and bangs at the same time to different outlets? just curious
    • Nov 13 2012 | 11:16 pm
      dunno but the help patch and reference page will tell you all about it...