We do something similar with the remote debug protocol. <br><br>if you look at the file&nbsp; WEB-INF/lps/lfc/debugger/platform/swf/LzRemote.as you will see the usage<br>of the Flash APIs. They can be accessed as normal Javascript for the most part. <br>
<br>For example the code to open and send a message looks like <br><br>Debug.sockOpen = function (port) {<br>&nbsp; var url = LzBrowser.getLoadURLAsLzURL();<br>&nbsp; // Security requires us to talk back to the server we were loaded from<br>
&nbsp; var host = url.host;<br>&nbsp; this.xsock = new XMLSocket();<br>&nbsp; this.xsock.onClose = this.brokensocket;<br>&nbsp; this.xsock.onXML = this.socketXMLAvailable;<br>&nbsp; if (! this.xsock.connect(host, port)) {<br>&nbsp;&nbsp;&nbsp; Debug.log(&quot;remote debugger could not connect to listener &quot; + host + &quot;:&quot; + port);<br>
&nbsp; }<br>&nbsp; this.writeInitMessage();<br>}<br><br><br>/**<br>&nbsp; * @access private<br>&nbsp; */<br>Debug.writeInitMessage = function () {<br>&nbsp;&nbsp;&nbsp; var filename = LzBrowser.getLoadURLAsLzURL();<br>&nbsp;&nbsp;&nbsp; var myXML = new XML();<br>&nbsp;&nbsp;&nbsp; var init = myXML.createElement(&quot;init&quot;); <br>
&nbsp;&nbsp;&nbsp; myXML.appendChild(init);<br>&nbsp;&nbsp;&nbsp; init.attributes.filename&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = filename;<br>&nbsp;&nbsp;&nbsp; init.attributes.language&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = &quot;LZX&quot;;<br>&nbsp;&nbsp;&nbsp; init.attributes.protocol_version = &quot;1.0&quot;;<br>&nbsp;&nbsp;&nbsp; init.attributes.build&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = canvas.lpsbuild;<br>
&nbsp;&nbsp;&nbsp; init.attributes.lpsversion = canvas.lpsversion;<br>&nbsp;&nbsp;&nbsp; init.attributes.lpsrelease = canvas.lpsrelease;<br>&nbsp;&nbsp;&nbsp; init.attributes.runtime&nbsp;&nbsp;&nbsp; = canvas.runtime;<br>&nbsp;&nbsp;&nbsp; init.attributes.appid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = &quot;0&quot;;<br>&nbsp;&nbsp;&nbsp; this.xsock.send(myXML);<br>
}<br><br><br>and the code to hook into the callback for received XML looks like<br><br>Debug.socketXMLAvailable = function (doc) {<br>&nbsp;&nbsp;&nbsp; var e = doc.firstChild;<br>&nbsp;&nbsp;&nbsp; var rloader = Debug.rdbloader;<br>&nbsp;&nbsp;&nbsp; if (e != null) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // clear warnings history<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.resetWarningHistory();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.inEvalRequest = true;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var seqnum = e.attributes[&#39;seq&#39;];<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (seqnum == null) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; seqnum = Debug.seqnum++;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (e.nodeName == &quot;exec&quot;) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var expr = e.firstChild.nodeValue;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rloader.request( { lz_load : false,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lzt : &quot;eval&quot;,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxied: true,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lzrdbseq : seqnum,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lz_script : &quot;#file evalString\n#line 0\n&quot; + expr } );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else if (e.nodeName == &quot;eval&quot;) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var expr = e.firstChild.nodeValue;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rloader.request( {&nbsp; lz_load : false,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lzt : &quot;eval&quot;,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; proxied: true,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lzrdbseq : seqnum,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lz_script : &quot;#file evalString\n#line 0\n&quot; + expr } );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else if (e.nodeName == &quot;inspect&quot;) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.inEvalRequest = false;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var id = <a href="http://e.attributes.id">e.attributes.id</a>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.sockWriteAsXML(Debug.ObjectForID(id), seqnum);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.inEvalRequest = false;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.sockWrite(&quot;&lt;response seq=&#39;&quot;+seqnum+&quot;&#39;&gt;&lt;error msg=&#39;unknown remote debug command&#39;&gt;&quot;+e.nodeName+&quot;&lt;/error&gt;&lt;/response&gt;&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.inEvalRequest = false;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Debug.sockWrite(&quot;&lt;response seq=&#39;-1&#39;&gt;&lt;error msg=&#39;null remote debug command&#39;/&gt;&lt;/response&gt;&quot;);<br>&nbsp;&nbsp;&nbsp; }<br>
}<br><br><br><br><br>You may want to put some of that code into a &lt;script when=&quot;immediate&quot;&gt; block <br><br><div class="gmail_quote">On Thu, May 8, 2008 at 9:30 AM, Evaldas Taroza &lt;<a href="mailto:etaroza@optaros.com">etaroza@optaros.com</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello,<br>
<br>
Thanks Henry for the pointer. Indeed I need a TCP socket. Normal Dataset will not do the job, I think.<br>
<br>
When you say to use Flash API, how do I do it? I mean, in Flash I suppose there is another programing language, like ActionScript, so how do I do it from within OL then?<br>
<br>
And when you say that Flash API is not officially supported by OL can it be that my app will eventually break, when you change somethings inside OL?<br>
<br>
A bit about my problems:<br>
As I told you I am taking my first steps with OL. So I decided to write some simple chat program, which would support a very small subset of XMPP. So as a start I need to send to the chat server the following text:<br>
&lt;?xml version=&#39;1.0&#39; encoding=&#39;UTF-8&#39;?&gt;<br>
 &nbsp;&lt;stream:stream<br>
 &nbsp; &nbsp;to=&#39;localhost&#39;<br>
 &nbsp; &nbsp;xmlns=&#39;jabber:client&#39;<br>
 &nbsp; &nbsp;xmlns:stream=&#39;<a href="http://etherx.jabber.org/streams" target="_blank">http://etherx.jabber.org/streams</a>&#39;<br>
 &nbsp; &nbsp;version=&#39;1.0&#39;&gt;<br>
<br>
And the server responds to something similar as well. As you can see it is not a well-formed XML document, so I need to treat it as text and parse it. All the subsequent communication happens with well-formed XML snippets.<br>

<br>
Do you think it&#39;s possible?<br>
<br>
Evaldas<br>
<br>
Henry Minsky wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
For streaming I/O to a TCP socket, if you restrict your self to the Flash runtime, you can use the Flash XMLSocket API , which has some restrictions, such as it must use TCP ports above 1024 I think.<br>
<br>
The API can be found in the Flash reference manual, it is not officially a supported API in OpelLaszlo though.<br>
<br>
We used this API for one of the remote debugger protocols at one point. There is still some code in the debugger implementation for it I think, which could be used as an example.<br>
<br>
<br></div><div class="Ih2E3d">
On Thu, May 8, 2008 at 12:35 AM, Evaldas Taroza &lt;<a href="mailto:etaroza@optaros.com" target="_blank">etaroza@optaros.com</a> &lt;mailto:<a href="mailto:etaroza@optaros.com" target="_blank">etaroza@optaros.com</a>&gt;&gt; wrote:<br>

<br>
 &nbsp; &nbsp;Dear OL users,<br>
<br>
 &nbsp; &nbsp;I am pretty new to OL. What I am trying to achieve is to open a<br>
 &nbsp; &nbsp;socket to a host (crossdomain) and read incoming textual data.<br>
<br>
 &nbsp; &nbsp;Incoming data will most likely be an XML document, but I don&#39;t want<br>
 &nbsp; &nbsp;to read the whole document, I rather need to deal with it as it<br>
 &nbsp; &nbsp;comes, in a streaming manner. How can I achieve this?<br>
<br>
 &nbsp; &nbsp;Thank you very much for help!<br>
<br>
 &nbsp; &nbsp;Evaldas<br>
<br>
 &nbsp; &nbsp;--  &nbsp; &nbsp;+41 79 616 53 76<br></div>
 &nbsp; &nbsp;<a href="http://www.linkedin.com/in/taroza" target="_blank">www.linkedin.com/in/taroza</a> &lt;<a href="http://www.linkedin.com/in/taroza" target="_blank">http://www.linkedin.com/in/taroza</a>&gt;<br>
<br>
 &nbsp; &nbsp;Optaros - <a href="http://www.optaros.com" target="_blank">www.optaros.com</a> &lt;<a href="http://www.optaros.com" target="_blank">http://www.optaros.com</a>&gt;<br>
<br>
<br>
<br>
<br>
-- <br>
Henry Minsky<br>
Software Architect<br>
<a href="mailto:hminsky@laszlosystems.com" target="_blank">hminsky@laszlosystems.com</a> &lt;mailto:<a href="mailto:hminsky@laszlosystems.com" target="_blank">hminsky@laszlosystems.com</a>&gt;<br>
<br>
</blockquote><div><div></div><div class="Wj3C7c">
<br>
<br>
<br>
-- <br>
+41 79 616 53 76<br>
<a href="http://www.linkedin.com/in/taroza" target="_blank">www.linkedin.com/in/taroza</a><br>
<br>
Optaros - <a href="http://www.optaros.com" target="_blank">www.optaros.com</a><br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Henry Minsky<br>Software Architect<br><a href="mailto:hminsky@laszlosystems.com">hminsky@laszlosystems.com</a><br><br>