1 Reply Latest reply on Mar 23, 2009 6:18 AM by danredman

    xmlSocket zero termination

    muzikathzi
      Hi
      I´m trying for hours to build a bidirectional communication with a tool that provides information over a XML socket.
      I can connect and send messages and recieve the onClose event but I do not recieve any Data.

      the tool I want to connect with is a tiny javascript using "socketwrench " to provide a socket.
      This tool works right. It communicates with other tools without problems but not with my flash file.

      I found out that it´s important that the string written on the socket is zero terminated.

      javascript code of the "server":

      function sendCommand(command){
      var tmpCommand = command +"\0";
      mySocket.sendLen = tmpCommand.length;
      mySocket.SendData = tmpCommand:
      [...]

      }

      --Flash code:--

      var xmlSocket = new XMLSocket();

      [other functions.....]

      xmlSocket.onData = function (src) {
      trace("data");
      }

      xmlSocket.connect("localhost", 3331);


      Can anyone tell me if this is the way zero termination is done, or if there are other things I have to think of?
      Does anyone know a tool or a trick how I can test if the string is zero terminated?
      Or a tool that sends zero terminated strings for testing?

      I´m grateful for every hint!!
      thanks,
      muzi