With the absence of the old automations, I find myself in need of a few hints for a tcp wrapper/listener for NAV2013.
Background: I send a XML file to an internal port, and will recieve an (String) answer back from another program on how the xml was handled.
For sending the xmlfile I have
IF ISNULL(TcpClient) THEN
TcpClient := TcpClient.TcpClient; //System.Net.Sockets.TcpClient
TcpClient.Connect("Network IP", Network Port");
Writer := Writer.StreamWriter(TcpClient.GetStream); //Writer is System.IO.StreamWriter
// Write info about the file that is going to be sent
Writer.Write('Document info here');
Writer.Write('');
Writer.Write('');
IF ISNULL(XMLDOM) THEN
XMLDOM := XMLDOM.XmlDocument;
XMLDOM.Load(XMLFilename);
Writer.Write(XMLDOM.OuterXml);
Writer.Flush;
This works like a charm. The other program recieves everything it needs, and responds. And so my problem begins. No matter how I try to get the response it ends in tears
I've tried with StreamReader, NetStream, straight from TcpClient but it just won't read the string i get returned. The closest I've got is with
netStream.Read(dnBytes, 0, TcpClient.ReceiveBufferSize); //dnBytes is System.Byte
but then it stops no matter how I try to get the byte to a string ](*,)
Any suggestions would be appreciated
Comments
Microsoft - Dynamics NAV