View network data

    Nov 05 2012 | 5:20 pm
    Hi - trying to access network data coming in to a program on my machine (OSX)
    I know the port it receives the data on, but when i tell either 'mxj net.rcv' or 'sadam.tcpReceiever' to look at that port, i get:
    'can't bind to port'
    which i suspect is because the application on my mac is already using it.
    any way to listen in on the network data coming in so my max patch can react to it?

    • Nov 07 2012 | 2:30 pm
      any ideas? thanks!!
    • Nov 07 2012 | 4:16 pm
      I gave a couple of days ago a very basic explanation of how ports etc. work in this thread: (just scroll down to approx. the middle of the thread). The thing is: you can't have two different things listening on the same port. So, if there's another software already using the port, you won't be able to connect to the same port. You can still use tools like Wireshark to analyze the global network traffic and filter somehow the incoming messages, however, I don't think that Wireshark had an option to forward specific data to a third-party application (although you never know).
      If the other software supports changing the port, then you could also do the following (which might or might not work, depending on how the other software implements IP communication): you could do a proxy in Max, which would catch all incoming data on the specified port, and then forward the information to another port, which your other software could catch. However, this might be quite complex, if not impossible, to implement if your software is using bidirectional communication (I have a bidirectional client in my library called [sadam.tcpClient], but I still didn't finish the implementation for a server).
      Hope that helps,
    • Nov 07 2012 | 4:31 pm
      Aha - was afraid of that. Thanks for the info!
    • Nov 07 2012 | 4:33 pm
      Maybe this will help. I don't know how your processing skills are but you can use carnivore (the first link) to capture traffic in processing and send that to max via osc (i don't know if that will interfere with the capturing though > feedbackloop?). Carnivore makes use of jpcap (the second link > java) which makes use of libpcap/tcpdump (the third link > c/c++) so you can go as deep as you want.
      Good luck,
    • Nov 07 2012 | 4:36 pm
      Thanks FRid! i'll give it a look!
    • Nov 07 2012 | 5:32 pm
      Lucky you :)
      This prints incoming network traffic to the maxwindow. you do need winpcap (if on win), oscp5 and procssing to make this work but it works.