How about:<br><br><br># Copyright (c) 2001-2004 Twisted Matrix Laboratories.<br># See LICENSE for details.<br><br><br>&quot;&quot;&quot;<br>An example client. Run simpleserv.py first before running this.<br>&quot;&quot;&quot;<br>
<br>from twisted.internet import reactor, protocol<br><br><br># a client protocol<br><br>class EchoClient(protocol.Protocol):<br>    &quot;&quot;&quot;Once connected, send a message, then print the result.&quot;&quot;&quot;<br>
    <br>    def connectionMade(self):<br>        self.transport.write(&quot;hello, world!&quot;)<br>    <br>    def dataReceived(self, data):<br>        &quot;As soon as any data is received, write it back.&quot;<br>        print &quot;Server said:&quot;, data<br>
        self.transport.loseConnection()<br>    <br>    def connectionLost(self, reason):<br>        print &quot;connection lost&quot;<br><br>class EchoFactory(protocol.ClientFactory):<br>    protocol = EchoClient<br><br>    def clientConnectionFailed(self, connector, reason):<br>
        print &quot;Connection failed - goodbye!&quot;<br>        reactor.stop()<br>    <br>    def clientConnectionLost(self, connector, reason):<br>        print &quot;Connection lost - goodbye!&quot;<br>        reactor.stop()<br>
<br><br># this connects the protocol to a server runing on port 8000<br>def main():<br>    f = EchoFactory()<br>    reactor.connectTCP(&quot;localhost&quot;, 8000, f)<br>    reactor.run()<br><br># this only runs if the module was *not* imported<br>
if __name__ == &#39;__main__&#39;:<br>    main()<br><br><br>-------------------------<br><br><br># Copyright (c) 2001-2004 Twisted Matrix Laboratories.<br># See LICENSE for details.<br><br><br>from twisted.internet import reactor, protocol<br>
<br><br>class Echo(protocol.Protocol):<br>    &quot;&quot;&quot;This is just about the simplest possible protocol&quot;&quot;&quot;<br>    <br>    def dataReceived(self, data):<br>        &quot;As soon as any data is received, write it back.&quot;<br>
        self.transport.write(data)<br><br><br>def main():<br>    &quot;&quot;&quot;This runs the protocol on port 8000&quot;&quot;&quot;<br>    factory = protocol.ServerFactory()<br>    factory.protocol = Echo<br>    reactor.listenTCP(8000,factory)<br>
    reactor.run()<br><br># this only runs if the module was *not* imported<br>if __name__ == &#39;__main__&#39;:<br>    main()<br><br>-----<br><br>Mark<br><br><br><div class="gmail_quote">On Wed, Feb 10, 2010 at 1:54 PM, Darren Govoni <span dir="ltr">&lt;<a href="mailto:darren@ontrenet.com">darren@ontrenet.com</a>&gt;</span> 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>
Hey Mark,<br>
   Yeah, that&#39;s what I want, but in the &#39;twisted&#39; way. I can write socket servers, etc. But didn&#39;t notice a good example of how to do this in Twisted (sparing me the socket programming),  until I found this old message[1] with the classes I think might work.<br>

<br>
[1] <a href="http://twistedmatrix.com/pipermail/twisted-python/2007-July/015738.html" target="_blank">http://twistedmatrix.com/pipermail/twisted-python/2007-July/015738.html</a><br>
<br>
Darren<br>
<br>
On Wed, 2010-02-10 at 13:36 -0500, Mark Bailey wrote:<br>
<blockquote type="CITE">
    Hi Darren:<br>
    <br>
    Why not use TCP?  You can send the length of the file at the beginning so you know how many bytes to listen for.<br>
    TCP guarantees delivery and ordering.<br>
    <br>
    Mark<br>
    <br>
</blockquote>
<blockquote type="CITE">
    On Wed, Feb 10, 2010 at 12:22 PM, Darren Govoni &lt;<a href="mailto:darren@ontrenet.com" target="_blank">darren@ontrenet.com</a>&gt; wrote:
</blockquote>
<blockquote type="CITE">
    <blockquote>
        Hi,<br>
          Is there an existing protocol that can provide the following?<br>
        <br>
        - Accept stream binary data FROM a client (e.g. very large file transfer)<br>
        - Receive data IN ORDER (i.e. stream. not out of order random packets)<br>
        <br>
        I want to stream FROM a client to the protocol server and have the<br>
        server process the stream bytes incrementally so it doesn&#39;t have <br>
        to store or write the entire data stream (too large).<br>
        <br>
        I looked at FileTransferServer and Client, but I&#39;m not sure it provides<br>
        what I need. <br>
        <br>
        Any tips appreciated!<br>
        <font color="#888888">Darren</font>
    </blockquote>
</blockquote>
<blockquote type="CITE">
    <blockquote>
        <br>
        _______________________________________________<br>
        Twisted-Python mailing list<br>
        <a href="mailto:Twisted-Python@twistedmatrix.com" target="_blank">Twisted-Python@twistedmatrix.com</a><br>
        <a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
        <br>
    </blockquote>
</blockquote>
<blockquote type="CITE">
    <br>
<pre>_______________________________________________
Twisted-Python mailing list
<a href="mailto:Twisted-Python@twistedmatrix.com" target="_blank">Twisted-Python@twistedmatrix.com</a>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a>
</pre>
</blockquote>
<br>
</div>

<br>_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
<br></blockquote></div><br>