how to send an integer value from Java to MAX via TCP?


    Aug 07 2008 | 7:16 pm
    sorry to disturb you, but we're having a samll problem the communication between a Java program and a MAX net.tcp.recv object via TCP.
    The Java program is a plain Java program which knows nothing about MAX; it just sends an integer value to an OutputStream of a Socket.
    The MAX net.tcp.recv indeed receives something, but it cannot print the integer value.
    How can we make this work? Is is related to the fact that Max uses "Atom args[]" rather than int?
    Thx in advance,
    -Wim

    • Aug 07 2008 | 8:53 pm
      hi
      what if you try with a simple udpreceive object ?
      g
      2008/8/7 Wim
      >
      > sorry to disturb you, but we're having a samll problem the communication
      > between a Java program and a MAX net.tcp.recv object via TCP.
      >
      > The Java program is a plain Java program which knows nothing about MAX; it
      > just sends an integer value to an OutputStream of a Socket.
      >
      > The MAX net.tcp.recv indeed receives something, but it cannot print the
      > integer value.
      >
      > How can we make this work? Is is related to the fact that Max uses "Atom
      > args[]" rather than int?
      >
      > Thx in advance,
      >
      > -Wim
      >
    • Aug 08 2008 | 5:35 am
      I'm assuming you get some sort of output, but it doesn't appear to be an
      integer. Can you see its value at all?
      Have you tried chaining a tosymbol object off the output? It might permit
      you to peek at the results.
      You could also try a JavaScript to receive output from the recv object, or
      even write a Java object to receive the message.
      -- Paul
      On Thu, Aug 7, 2008 at 2:16 PM, Wim wrote:
      >
      > sorry to disturb you, but we're having a samll problem the communication
      > between a Java program and a MAX net.tcp.recv object via TCP.
      >
      > The Java program is a plain Java program which knows nothing about MAX; it
      > just sends an integer value to an OutputStream of a Socket.
      >
      > The MAX net.tcp.recv indeed receives something, but it cannot print the
      > integer value.
      >
      > How can we make this work? Is is related to the fact that Max uses "Atom
      > args[]" rather than int?
      >
      > Thx in advance,
      >
      > -Wim
      >
      --
      ----- |(*,+,#,=)(#,=,*,+)(=,#,+,*)(+,*,=,#)| -----
    • Aug 08 2008 | 9:28 am
      if you're sending raw packets, maybe you can use the aka.datagram object...
      g
      2008/8/8 Paul Hertz
      > I'm assuming you get some sort of output, but it doesn't appear to be an
      > integer. Can you see its value at all?
      >
      > Have you tried chaining a tosymbol object off the output? It might permit
      > you to peek at the results.
      >
      > You could also try a JavaScript to receive output from the recv object, or
      > even write a Java object to receive the message.
      >
      > -- Paul
      >
      >
      >
      > On Thu, Aug 7, 2008 at 2:16 PM, Wim wrote:
      >
      >>
      >> sorry to disturb you, but we're having a samll problem the communication
      >> between a Java program and a MAX net.tcp.recv object via TCP.
      >>
      >> The Java program is a plain Java program which knows nothing about MAX; it
      >> just sends an integer value to an OutputStream of a Socket.
      >>
      >> The MAX net.tcp.recv indeed receives something, but it cannot print the
      >> integer value.
      >>
      >> How can we make this work? Is is related to the fact that Max uses "Atom
      >> args[]" rather than int?
      >>
      >> Thx in advance,
      >>
      >> -Wim
      >>
      >
      >
      >
      > --
      > ----- |(*,+,#,=)(#,=,*,+)(=,#,+,*)(+,*,=,#)| -----
      >
      >
      >
    • Aug 10 2008 | 12:42 am
      If you want to send raw int data you probably need to write your own mxj
      class to deal iwith it. There are tonnes of java server/socket examples
      on the internet. I imagine net.tcp stuff is expecting atoms not raw
      ints. If you wrote your own mxj class it could just read raw ints from
      the socket.
      /* FROM SIDEKICK LX*/