[Twisted-Python] VC++ client and a Twisted OpenSSL Server

2009-09-23 Thread gary clark
Hello,

Firstly I'm new to twisted hence patience and a deep breath my be necessary.

I wrote a simple VC++ client that communicates to a VC++ server using OpenSSL. 
It loads .pem file and communicates great.

However I want the client to talk to a twisted server provided from 
TwistedMatrix:

# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.


from OpenSSL import SSL
from twisted.internet.protocol import Factory
from twisted.internet import ssl, reactor
from twisted.python import log

class ServerContextFactory:

def getContext(self):
"""Create an SSL context.

This is a sample implementation that loads a certificate from a file 
called 'server.pem'."""
ctx = SSL.Context(SSL.SSLv23_METHOD)
ctx.use_certificate_file('nfdclient.pem')
ctx.use_privatekey_file('nfdclient.pem')
return ctx


if __name__ == '__main__':
import echoserv, sys
log.startLogging(sys.stdout)
factory = Factory()
factory.protocol = echoserv.Echo
port =int(sys.argv[1])
reactor.listenSSL(port, factory, ServerContextFactory())
reactor.run()


When attempting to connect the client, it failed on BIO_do_connect.

Has anybody attempted to do this? If so could they shed some light into the 
direction of getting the BIO to connect.

Thanks,
Garyc

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] VC++ client and a Twisted OpenSSL Server

2009-09-23 Thread gary clark
Hello,

error:02002751:system library:connect:reason(1873)

Is dumped out from the client. This apparently is a :

0x2751 == 10065 == (WSA)EHOSTUNREACH
> "A socket operation was attempted to an unreachable host."

Strange because I can ping the server machine from the client. Not very 
informative.

Oh boy any ideas? I'm running the client on windows and the twisted server on 
linux.

Thanks,
Garyc



___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] VC++ client and a Twisted OpenSSL Server

2009-09-23 Thread gary clark
Ok I downloaded wireshark onto the linux box and commenced sniffing the 
packets. I saw the problem with sending the packets back (Host unreachable). 
Dont know why the pings were not being stopped (proabably allowing ICMP).

I then enable the port on the linux box.

I am now seeing the following:

error:0200274D:system library:connect:reason(1869)
ECONNREFUSED = 0x274D = 10061

Any ideas would be appreciated.

Thanks,
Garyc

--- On Wed, 9/23/09, gary clark  wrote:

> From: gary clark 
> Subject: [Twisted-Python] VC++ client and a Twisted OpenSSL Server
> To: twisted-python@twistedmatrix.com
> Date: Wednesday, September 23, 2009, 8:03 PM
> Hello,
> 
> error:02002751:system library:connect:reason(1873)
> 
> Is dumped out from the client. This apparently is a :
> 
> 0x2751 == 10065 == (WSA)EHOSTUNREACH
> > "A socket operation was attempted to an unreachable
> host."
> 
> Strange because I can ping the server machine from the
> client. Not very informative.
> 
> Oh boy any ideas? I'm running the client on windows and the
> twisted server on linux.
> 
> Thanks,
> Garyc
> 
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Twisted OpenSSL Server Debug Information

2009-09-24 Thread gary clark
Hello,

I am a new guy looking into the twisted platform.

I am trying to track down why the twisted server using open-ssl is
failing to communicate to my VC++ open-ssl client:

error:0200274D:system library:connect:reason(1869)

I am seeing 0x274D which is a ECONNREFUSED 10061 not sure what the
exact reason is. However would like to debug it at the twisted server so I can 
get more information on what is going on. I now know that the packets are going 
back and forth to the machines.

Simply put what is the recommended way to debug the twisted server so I can 
discover why the connection failed to the server? 


Much appreciated,
Garyc


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted OpenSSL Server Debug Information

2009-09-24 Thread gary clark

Oh boy. I finally got it working and connecting. Now to move onto the real 
stuff.


--- On Thu, 9/24/09, gary clark  wrote:

> From: gary clark 
> Subject: [Twisted-Python] Twisted OpenSSL Server Debug Information
> To: twisted-python@twistedmatrix.com
> Date: Thursday, September 24, 2009, 7:45 AM
> Hello,
> 
> I am a new guy looking into the twisted platform.
> 
> I am trying to track down why the twisted server using
> open-ssl is
> failing to communicate to my VC++ open-ssl client:
> 
> error:0200274D:system library:connect:reason(1869)
> 
> I am seeing 0x274D which is a ECONNREFUSED 10061 not sure
> what the
> exact reason is. However would like to debug it at the
> twisted server so I can get more information on what is
> going on. I now know that the packets are going back and
> forth to the machines.
> 
> Simply put what is the recommended way to debug the twisted
> server so I can discover why the connection failed to the
> server? 
> 
> 
> Much appreciated,
> Garyc
> 
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Twisted OpenSSL Server and multiple clients

2009-09-27 Thread gary clark
Hello,

I am new to Twisted, hence the red flag and patience card pulled out.

I have written a client that connects perfectly well to a twisted server thats 
using open-ssl to communicate to each other. Basically I took the open-ssl echo 
server example and tweaked it.

Thats all fine and dandy, but I want to have multiple clients that can connect 
to the server.

So I have a few questions:

1) When a client connects to my server? What connection information
   can be collected and stored persistently? 

   Upon a client connecting I want to store connection information and
   I want to remove connection information when its disconnected from 
   the persistent store.

2) What persistent store is adopted for twisted if any?

3) I want to know when a table has changed so I can then pull information
   from a table and use the connection information if present to send data 
   to my client. How is this accomplished in twisted?

Again I apologise in advance, if someone can shed some light into how twisted 
accomplishes the basic tasks of multiple clients thats great.

Oh boy.

Thanks,
Garyc





___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted OpenSSL Server and multiple clients

2009-09-27 Thread gary clark
Ok I'm answering my own questions:

After browsing around I kinda pieced together what is going on.

Basically the factory object manages the persistent information
of protcols. You can use self.clients.append( newclient )
to store when a connection is made and self.clients.remove( client ) when a 
client disconnects within the factory object to cycle through all the protocol 
(clients) in the factory:

In the factory:

for proto in self.clients
proto.transport.write( message )

I found the below code very useful:

import string
from twisted.application import service, internet
from twisted.internet import reactor, protocol
from twisted.internet.protocol import Protocol, Factory

port = 80

class AirChat(Protocol):

username = ""
session = False

def connectionMade( self ):
self.factory.numProtocols = self.factory.numProtocols+1
self.factory.addClient(  self )

def connectionLost( self , reason ):
self.factory.numProtocols = self.factory.numProtocols-1
self.factory.delClient( self )

def dataReceived( self , data ):

# parse out HTTP
a = data.split( '\x00' )[0].split(' ')

# look for HTTP header
if a[0] == 'GET' or a[0] == 'POST':
self.transport.write( """HTTP/1.1 200 OK\r\n\r\n""" )
self.transport.write( """AIR Chat 
1.0""" )
self.transport.loseConnection()
return

a = data.split( '\x00' )[0].split( '||' )

if a[0] == '1':
self.factory.sendAll( '1||' + self.factory.stripChars( 
a[1] ) + '||' + self.factory.stripChars( a[2] ) + '\x00'  )

elif a[0] == '2':
self.transport.write( '2||' + str( 
self.factory.numProtocols )  + '\x00')


class AirChatFactory(Factory):
protocol = AirChat
numProtocols = 0
clients = []

def stripChars(self, textIn):
textIn = textIn.replace('<', '')
textIn = textIn.replace('', '')
textIn = textIn.replace('/>', '')
return textIn

def addClient(self, newclient):
self.clients.append( newclient )

def delClient(self, client):
self.clients.remove( client )

def sendAll(self, message):
for proto in self.clients:
proto.transport.write( message )


class AirChatService( internet.TCPServer ):
    def __init__(self):
    internet.TCPServer.__init__(self, 80, AirChatFactory())


I think thats good for now. I dont have to create my own repository just 
manipulate the factory object, marvelous. Time for a pint.

Thanks,
Garyc

--- On Sun, 9/27/09, gary clark  wrote:

> From: gary clark 
> Subject: Twisted OpenSSL Server and multiple clients
> To: twisted-python@twistedmatrix.com
> Date: Sunday, September 27, 2009, 3:08 PM
> Hello,
> 
> I am new to Twisted, hence the red flag and patience card
> pulled out.
> 
> I have written a client that connects perfectly well to a
> twisted server thats using open-ssl to communicate to each
> other. Basically I took the open-ssl echo server example and
> tweaked it.
> 
> Thats all fine and dandy, but I want to have multiple
> clients that can connect to the server.
> 
> So I have a few questions:
> 
> 1) When a client connects to my server? What connection
> information
>    can be collected and stored persistently?
> 
> 
>    Upon a client connecting I want to store
> connection information and
>    I want to remove connection information
> when its disconnected from 
>    the persistent store.
> 
> 2) What persistent store is adopted for twisted if any?
> 
> 3) I want to know when a table has changed so I can then
> pull information
>    from a table and use the connection
> information if present to send data 
>    to my client. How is this accomplished in
> twisted?
> 
> Again I apologise in advance, if someone can shed some
> light into how twisted accomplishes the basic tasks of
> multiple clients thats great.
> 
> Oh boy.
> 
> Thanks,
> Garyc
> 
> 
> 
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Knowing end of packet

2009-09-28 Thread gary clark
Hello,

I am sending a large amount of data to a twisted server. I want to know how
the protocol class knows that no more data is to be received. 

I dont pass the length of the data in the packet, hence I'm looking for a 
termination field in the packet.Like .

I did see a logging class but not sure if thats what I want. If I have to
overload the dataReceived method, and buffer the data until I see the 
termination field thats ok, just need to know if this seems correct in twisted.

Much appreciated for any help.

Thanks,
Garyc


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Knowing end of packet

2009-09-28 Thread gary clark

Marvelous. Much appreciated. 

"from twisted.protocols.basic import NetstringReceiver"

Thanks,
Garyc
--- On Mon, 9/28/09, Glyph Lefkowitz  wrote:

> From: Glyph Lefkowitz 
> Subject: Re: [Twisted-Python] Knowing end of packet
> To: "Twisted general discussion" 
> Date: Monday, September 28, 2009, 6:29 AM
> On Mon, Sep 28,
> 2009 at 7:15 AM, gary clark 
> wrote:
> 
> Hello,
> 
> 
> 
> I am sending a large amount of data to a twisted server. I
> want to know how
> 
> the protocol class knows that no more data is to be
> received.
> 
> 
> 
> I dont pass the length of the data in the packet, hence
> I'm looking for a termination field in the packet.Like
> .
> 
> I think this FAQ might help you:
> 
> http://twistedmatrix.com/trac/wiki/FrequentlyAskedQuestions#Whyisprotocol.dataReceivedcalledwithonlypartofthedataIcalledtransport.writewith
> 
> 
> 
> Let us know if that answers your question.
> 
> 
> 
> -Inline Attachment Follows-
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Twisted and db table changes

2009-09-28 Thread gary clark
Hello,

I have a server that needs to track changes on a table database.

When a table changes it needs the server accesses the table and send data out.

Not sure what the best approach to do this in twisted. Do I create a thread in 
twisted and monitor for any changes in a table or can I create
a callback method to be triggered when a change occurs to table.

Thanks,
Garyc




___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted and db table changes

2009-10-01 Thread gary clark
Thanks for the information, thats what I need to use in this case

"wisted.internet.task.LoopingCall".


Great support.

Much appreciated,
Garyc


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] XML parsing on twisted

2009-10-01 Thread gary clark
Hello,

Probably a pretty standard question. However what are recommended mechanics of 
parsing XML on twisted? I have a humongous string that needs to be parsed and 
pushed into a database in the right columns.

Much appreciated in advance,
Garyc



___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted and db table changes

2009-10-01 Thread gary clark
I'm building a website with twisted and pylons which I hope to release in 
December. I cant explain what the idea is, but I like python and the twisted 
site seems excellent. Smart guys, hopefully I can reciprocate one day.

Cheers,
Garyc

--- On Thu, 10/1/09, Steve  wrote:

> From: Steve 
> Subject: Re: [Twisted-Python] Twisted and db table changes
> To: "Twisted general discussion" 
> Date: Thursday, October 1, 2009, 4:49 PM
> Thanks
> for the suggestion. I will look into replacing select but
> first I need to learn more about Twisted. I just discovered
> it a week or so ago.
> 
> I will probably change the main site. A more
> durable link would be http://www.divillo.com/asyncnotify.html
> 
> 
> 
>  Original Message 
> 
> Subject: Re: [Twisted-Python] Twisted and db table changes
> 
> From: Glyph Lefkowitz 
> 
> Date: Thu, October 01, 2009 1:51 pm
> 
> To: Twisted general discussion
> 
> 
> 
> 
> On Thu, Oct 1, 2009 at 4:27 PM,
> Steve 
> wrote:
>  If you are using PostgreSQL you
> can use this technique
>  
>  http://www.divillo.com
> 
> 
> This is very interesting, thanks for sharing!
> 
> However, whenever I see a Twisted program calling
> select()... especially select() in a thread ;-) I wonder if
> things couldn't be made a bit simpler, responsive, and
> performant by just asking the Twisted main loop to monitor
> the file descriptor instead.  It looks like
> "psycho pig two" has the functionality that you
> need.
>  
> (Are you planning to keep this technique described on the
> front of your website indefinitely?  If not, a more
> durable link would be great :).)
> 
> 
> ___
> 
> Twisted-Python mailing list
> 
> Twisted-Python@twistedmatrix.com
> 
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 
> 
> 
>  
> 
> 
> -Inline Attachment Follows-
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] XML parsing on twisted

2009-10-03 Thread gary clark
Hello,

I went to use the SAX library to perform parsing. However I hit an unusual
problem.

Its having a problem parsing a token that has a '&' it just crashes. It 
certainly woke me up when I witnessed this.

 Jim & Nancy 

are passed to the ContentHandler class. When characters(self,chars) member gets 
called I perform self.book+=chars to reassemble the string.

I dump out the self.book string as its being assembled. If I replace the '&' 
character with "and" then its Ok. Of course I dont want to have to replace '&' 
with 'and'.

Not good. So has anybody else seen this problem. I'm assuming it thinks its a 
reference and becomes confused when I attempt to add a reference.

Much appreciated,
Garyc


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] XML parsing on twisted

2009-10-03 Thread gary clark
thanks. ughh! 10 years old. oh boy.

Garyc

--- On Sat, 10/3/09, Amaury Forgeot d'Arc  wrote:

> From: Amaury Forgeot d'Arc 
> Subject: Re: [Twisted-Python] XML parsing on twisted
> To: "Twisted general discussion" 
> Date: Saturday, October 3, 2009, 5:42 PM
> Hi,
> 
> 2009/10/4 gary clark :
> > Hello,
> >
> > I went to use the SAX library to perform parsing.
> However I hit an unusual
> > problem.
> >
> > Its having a problem parsing a token that has a
> '&' it just crashes. It certainly woke me up when I
> witnessed this.
> >
> >  Jim & Nancy 
> >
> > are passed to the ContentHandler class. When
> characters(self,chars) member gets called I perform
> self.book+=chars to reassemble the string.
> >
> > I dump out the self.book string as its being
> assembled. If I replace the '&' character with "and"
> then its Ok. Of course I dont want to have to replace
> '&' with 'and'.
> >
> > Not good. So has anybody else seen this problem. I'm
> assuming it thinks its a reference and becomes confused when
> I attempt to add a reference.
> >
> > Much appreciated,
> 
> the & character is a special character in XML. You are
> parsing an
> invalid XML string.
> This page says it well:
> http://www.devx.com/tips/Tip/14068
> (a 10 years old "tip of the day"!)
> 
> -- 
> Amaury Forgeot d'Arc
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Sending jpeg data over TCP/IP

2010-02-13 Thread gary clark
Hello,

I want to send raw binary data but also text in the message. I am currently 
sending ascii data to the twisted server via open-ssl.
Its great and twisted is cool. However I want to send a name of document and 
then the raw data in the same message? Is this possible with twisted.
Essentially I want to store the file in a location based upon its name.
Is this even practical to do this? Not sure.

Say for instance

gazza.doc
0101110100101010010010110010101010101101010

I dont know if the SAX parser which I am using could parse this data?

Thanks,
Garyc





___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Sending jpeg data over TCP/IP

2010-02-14 Thread gary clark
There are probably several way to accomplish this I just needed to think about 
it a wee bit longer. One way would be to prepend an identifier to the 
file,strip the header from the raw data on reception and then save the image. I 
dont think its complicated. I may need a seperate server to handle the files 
though.

Thanks,
Garyc

--- On Sat, 2/13/10, Maarten ter Huurne  wrote:

> From: Maarten ter Huurne 
> Subject: Re: [Twisted-Python] Sending jpeg data over TCP/IP
> To: "Twisted general discussion" 
> Date: Saturday, February 13, 2010, 6:07 PM
> On Sunday 14 February 2010, Alexandre
> Quessy wrote:
> 
> > This said, sending them using a programmer's solution
> - not a sysadmin
> > solution - would be closer to my own skills, so I am
> interested in
> > knowing if this could be suitable. I think, though,
> that it would be
> > faster to use a transfert protocol that would be
> implemented in C, not
> > Python. Am I wrong?
> 
> I would suggest to implement it in Python first and then
> benchmark it. Maybe 
> the simplest implementation is already fast enough. Maybe
> the bottleneck is 
> the network or the disk you're writing to; in that case you
> would be better 
> off upgrading your switches or buying an SSD instead of
> writing C code.
> 
> Bye,
>         Maarten
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Sending jpeg data over TCP/IP

2010-02-14 Thread gary clark

hey Alexandra,

The only reason why I suggested another server would be to distribute the
load on the system. Essentially the files that are intended to be sent over 
will consume alot of processing since .jpeg etc are humongous.
Yes two connections would be required. Well you could use the MD5 sum, I will 
not, essentially your after a unique identifier that represents the file your 
sending. What I intend to do is simply embed the filename and unique identifier 
as a header. Hence I do not not need to recompute the MD5 at the receiving end, 
which to be honest seems overkill. 

Anyway good luck. KISS for software is the best approach.

Thanks,
Garyc


--- On Sun, 2/14/10, Alexandre Quessy  wrote:

> From: Alexandre Quessy 
> Subject: Re: [Twisted-Python] Sending jpeg data over TCP/IP
> To: "Twisted general discussion" 
> Date: Sunday, February 14, 2010, 11:10 AM
> Hello again everyone,
> Maybe using two senders/receivers would help. The control
> protocol,
> which can use XML or JSON, or whatever, would identify the
> files by
> their md5 sum? The file transfert protocol would detect the
> header of
> each file to separate them.
> 
> a
> 
> gary clark wrote:
> > There are probably several way to accomplish this I
> just needed to think about it a wee bit longer. One way
> would be to prepend an identifier to the file,strip the
> header from the raw data on reception and then save the
> image. I dont think its complicated. I may need a seperate
> server to handle the files though.
> > 
> > Thanks,
> > Garyc
> > 
> > --- On Sat, 2/13/10, Maarten ter Huurne 
> wrote:
> > 
> >> From: Maarten ter Huurne 
> >> Subject: Re: [Twisted-Python] Sending jpeg data
> over TCP/IP
> >> To: "Twisted general discussion" 
> >> Date: Saturday, February 13, 2010, 6:07 PM
> >> On Sunday 14 February 2010, Alexandre
> >> Quessy wrote:
> >>
> >>> This said, sending them using a programmer's
> solution
> >> - not a sysadmin
> >>> solution - would be closer to my own skills,
> so I am
> >> interested in
> >>> knowing if this could be suitable. I think,
> though,
> >> that it would be
> >>> faster to use a transfert protocol that would
> be
> >> implemented in C, not
> >>> Python. Am I wrong?
> >> I would suggest to implement it in Python first
> and then
> >> benchmark it. Maybe 
> >> the simplest implementation is already fast
> enough. Maybe
> >> the bottleneck is 
> >> the network or the disk you're writing to; in that
> case you
> >> would be better 
> >> off upgrading your switches or buying an SSD
> instead of
> >> writing C code.
> >>
> >> Bye,
> >>         Maarten
> >>
> >> ___
> >> Twisted-Python mailing list
> >> Twisted-Python@twistedmatrix.com
> >> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> >>
> > 
> > 
> > ___
> > Twisted-Python mailing list
> > Twisted-Python@twistedmatrix.com
> > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> > 
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Pulling the ethernet cable out

2010-02-16 Thread gary clark
Hello,

I'm tested my client server model. The server being a twisted server.
I am using the class NetstringReceiver. When I close down the client the 
appropriate call to close the connection is made "connectionLost". However when 
I just pull the client connection cable from the network. I would expect the 
call to be made to indicate a connection is lost at the twisted server. I dont 
see this. 

I am going through a local hub and not sure what at the moment to think of 
this. I am using ssl to communicate.

If somebody could shed some light on this that would be great.

Thanks,
Garyc




___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Pulling the ethernet cable out

2010-02-16 Thread gary clark
Much appreciated Alvin.

--- On Tue, 2/16/10, Alvin Delagon  wrote:

> From: Alvin Delagon 
> Subject: Re: [Twisted-Python] Pulling the ethernet cable out
> To: "Twisted general discussion" 
> Date: Tuesday, February 16, 2010, 10:31 AM
> Hello Garyc,
> This is not twisted's fault. Pulling a
> network plug doesn't tell the server that the client
> went away immediately since the connection wasn't closed
> properly. Pulling the plug produces TCP half-open scenario
> when one thinks that the connection is still up. This can be
> remedied by polling/hearbeat/keepalive logic. You can make
> your twisted server aware of the keepalive timeouts by
> turning on setTcpKeepAlive to 1:
> 
> self.transport.setTcpKeepAlive(1)
> Cheers,Alvin
> 
> On Wed, Feb 17, 2010 at 12:15 AM,
> gary clark 
> wrote:
> 
> Hello,
> 
> 
> 
> I'm tested my client server model. The server being a
> twisted server.
> 
> I am using the class NetstringReceiver. When I close down
> the client the appropriate call to close the connection is
> made "connectionLost". However when I just pull
> the client connection cable from the network. I would expect
> the call to be made to indicate a connection is lost at the
> twisted server. I dont see this.
> 
> 
> 
> 
> I am going through a local hub and not sure what at the
> moment to think of this. I am using ssl to communicate.
> 
> 
> 
> If somebody could shed some light on this that would be
> great.
> 
> 
> 
> Thanks,
> 
> Garyc
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ___
> 
> Twisted-Python mailing list
> 
> Twisted-Python@twistedmatrix.com
> 
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 
> 
> 
> 
> -- 
> http://www.alvinatorsplayground.blogspot.com/
> 
> 
> 
> -Inline Attachment Follows-
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Pulling the ethernet cable out

2010-02-16 Thread gary clark
I have to poll at the twisted server "getTcpKeepAlive" for the state of the 
keep alive.


Thanks,
Garyc

--- On Tue, 2/16/10, gary clark  wrote:

> From: gary clark 
> Subject: [Twisted-Python] Pulling the ethernet cable out
> To: "Twisted general discussion" 
> Date: Tuesday, February 16, 2010, 10:15 AM
> Hello,
> 
> I'm tested my client server model. The server being a
> twisted server.
> I am using the class NetstringReceiver. When I close down
> the client the appropriate call to close the connection is
> made "connectionLost". However when I just pull the client
> connection cable from the network. I would expect the call
> to be made to indicate a connection is lost at the twisted
> server. I dont see this. 
> 
> I am going through a local hub and not sure what at the
> moment to think of this. I am using ssl to communicate.
> 
> If somebody could shed some light on this that would be
> great.
> 
> Thanks,
> Garyc
> 
> 
> 
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Pulling the ethernet cable out

2010-02-16 Thread gary clark
Hey Alvin,

In the document link you provided the packets are being sent periodically every 
2 hours for setTcpKeepAlive(1). I am assuming that
the a packet is sent straight away and then waits. At the moment I dont see the 
connection lost. The getTcpKeepAlive() is returning 1 indicating that keep 
alive is set.

Is there a way to change the delay?

Thanks,
Garyc



--- On Tue, 2/16/10, Alvin Delagon  wrote:

> From: Alvin Delagon 
> Subject: Re: [Twisted-Python] Pulling the ethernet cable out
> To: "Twisted general discussion" 
> Date: Tuesday, February 16, 2010, 11:19 AM
> Hello,
> No, getTcpKeepAlive will only tell you if
> SO_KEEPALIVE is enabled. It's setTcpKeepAlive you want.
> If it's enabled, once the keepalive times out on a
> half-open scenario, the connectionLost method will be
> triggered. You can read the API docs here:
> 
> http://twistedmatrix.com/documents/8.2.0/api/twisted.internet.tcp.Connection.html#getTcpKeepAlive
> http://twistedmatrix.com/documents/8.2.0/api/twisted.internet.tcp.Connection.html#setTcpKeepAlive
> 
> Best Regards,Alvin
> 
> On Wed, Feb 17, 2010 at 1:06 AM,
> gary clark 
> wrote:
> 
> I have to
> poll at the twisted server "getTcpKeepAlive" for
> the state of the keep alive.
> 
> 
> 
> 
> 
> Thanks,
> 
> Garyc
> 
> 
> 
> --- On Tue, 2/16/10, gary clark 
> wrote:
> 
> 
> 
> > From: gary clark 
> 
> > Subject: [Twisted-Python] Pulling the ethernet cable
> out
> 
> > To: "Twisted general
> discussion" 
> 
> > Date: Tuesday, February 16, 2010, 10:15 AM
> 
> > Hello,
> 
> >
> 
> > I'm tested my client server model. The server
> being a
> 
> > twisted server.
> 
> > I am using the class NetstringReceiver. When I close
> down
> 
> > the client the appropriate call to close the
> connection is
> 
> > made "connectionLost". However when I just
> pull the client
> 
> > connection cable from the network. I would expect the
> call
> 
> > to be made to indicate a connection is lost at the
> twisted
> 
> > server. I dont see this.
> 
> >
> 
> > I am going through a local hub and not sure what at
> the
> 
> > moment to think of this. I am using ssl to
> communicate.
> 
> >
> 
> > If somebody could shed some light on this that would
> be
> 
> > great.
> 
> >
> 
> > Thanks,
> 
> > Garyc
> 
> >
> 
> >
> 
> >
> 
> >
> 
> > ___
> 
> > Twisted-Python mailing list
> 
> > Twisted-Python@twistedmatrix.com
> 
> > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 
> >
> 
> 
> 
> 
> 
> ___
> 
> Twisted-Python mailing list
> 
> Twisted-Python@twistedmatrix.com
> 
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 
> 
> 
> 
> -- 
> http://www.alvinatorsplayground.blogspot.com/
> 
> 
> 
> -Inline Attachment Follows-
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Pulling the ethernet cable out

2010-02-16 Thread gary clark

Much appreciated the response. setTcpKeepAlive(1) is good for calling
connectionLst, however I have to send a packet out to trigger this event.
Its too bad, just had to send periodically a small stay-alive packet.

Thanks,
Garyc



--- On Tue, 2/16/10, Alec Matusis  wrote:

> From: Alec Matusis 
> Subject: Re: [Twisted-Python] Pulling the ethernet cable out
> To: "'Twisted general discussion'" 
> Date: Tuesday, February 16, 2010, 2:47 PM
> Assuming you are on Linux, you can
> run
> 
> #man tcp 
> 
> and take a look at the tunable parameters that control TCP
> protocol
> timeouts:
> 
> tcp_keepalive_intvl
> tcp_keepalive_probes
> tcp_keepalive_time
> 
> They can be tuned via /proc filesystem.
> These changes are system-wide, so you should consider the
> performance of
> other applications on this system with those changes.
> 
> > -Original Message-
> > From: twisted-python-boun...@twistedmatrix.com
> [mailto:twisted-python-
> > boun...@twistedmatrix.com]
> On Behalf Of gary clark
> > Sent: Tuesday, February 16, 2010 10:19 AM
> > To: Twisted general discussion
> > Subject: Re: [Twisted-Python] Pulling the ethernet
> cable out
> > 
> > Hey Alvin,
> > 
> > In the document link you provided the packets are
> being sent periodically
> > every 2 hours for setTcpKeepAlive(1). I am assuming
> that
> > the a packet is sent straight away and then waits. At
> the moment I dont
> see
> > the connection lost. The getTcpKeepAlive() is
> returning 1 indicating that
> keep
> > alive is set.
> > 
> > Is there a way to change the delay?
> > 
> > Thanks,
> > Garyc
> > 
> > 
> > 
> > --- On Tue, 2/16/10, Alvin Delagon 
> wrote:
> > 
> > > From: Alvin Delagon 
> > > Subject: Re: [Twisted-Python] Pulling the
> ethernet cable out
> > > To: "Twisted general discussion" 
> > > Date: Tuesday, February 16, 2010, 11:19 AM
> > > Hello,
> > > No, getTcpKeepAlive will only tell you if
> > > SO_KEEPALIVE is enabled. It's setTcpKeepAlive you
> want.
> > > If it's enabled, once the keepalive times out on
> a
> > > half-open scenario, the connectionLost method
> will be
> > > triggered. You can read the API docs here:
> > >
> > >
> > http://twistedmatrix.com/documents/8.2.0/api/twisted.internet.tcp.Connecti
> > on.html#getTcpKeepAlive
> > >
> > http://twistedmatrix.com/documents/8.2.0/api/twisted.internet.tcp.Connecti
> > on.html#setTcpKeepAlive
> > >
> > > Best Regards,Alvin
> > >
> > > On Wed, Feb 17, 2010 at 1:06 AM,
> > > gary clark 
> > > wrote:
> > >
> > > I have to
> > > poll at the twisted server "getTcpKeepAlive" for
> > > the state of the keep alive.
> > >
> > >
> > >
> > >
> > >
> > > Thanks,
> > >
> > > Garyc
> > >
> > >
> > >
> > > --- On Tue, 2/16/10, gary clark 
> > > wrote:
> > >
> > >
> > >
> > > > From: gary clark 
> > >
> > > > Subject: [Twisted-Python] Pulling the
> ethernet cable
> > > out
> > >
> > > > To: "Twisted general
> > > discussion" 
> > >
> > > > Date: Tuesday, February 16, 2010, 10:15 AM
> > >
> > > > Hello,
> > >
> > > >
> > >
> > > > I'm tested my client server model. The
> server
> > > being a
> > >
> > > > twisted server.
> > >
> > > > I am using the class NetstringReceiver. When
> I close
> > > down
> > >
> > > > the client the appropriate call to close
> the
> > > connection is
> > >
> > > > made "connectionLost". However when I just
> > > pull the client
> > >
> > > > connection cable from the network. I would
> expect the
> > > call
> > >
> > > > to be made to indicate a connection is lost
> at the
> > > twisted
> > >
> > > > server. I dont see this.
> > >
> > > >
> > >
> > > > I am going through a local hub and not sure
> what at
> > > the
> > >
> > > > moment to think of this. I am using ssl to
> > > communicate.
> > >
> > > >
> > >
> > > > If somebody could shed some light on thi

Re: [Twisted-Python] Sending jpeg data over TCP/IP

2010-02-22 Thread gary clark
The correct way I think is to use base64 and just one connection after more 
research. Good to research.

Thanks,
Garyc

--- On Sun, 2/14/10, gary clark  wrote:

> From: gary clark 
> Subject: Re: [Twisted-Python] Sending jpeg data over TCP/IP
> To: "Twisted general discussion" 
> Date: Sunday, February 14, 2010, 12:18 PM
> 
> hey Alexandra,
> 
> The only reason why I suggested another server would be to
> distribute the
> load on the system. Essentially the files that are intended
> to be sent over will consume alot of processing since .jpeg
> etc are humongous.
> Yes two connections would be required. Well you could use
> the MD5 sum, I will not, essentially your after a unique
> identifier that represents the file your sending. What I
> intend to do is simply embed the filename and unique
> identifier as a header. Hence I do not not need to recompute
> the MD5 at the receiving end, which to be honest seems
> overkill. 
> 
> Anyway good luck. KISS for software is the best approach.
> 
> Thanks,
> Garyc
> 
> 
> --- On Sun, 2/14/10, Alexandre Quessy 
> wrote:
> 
> > From: Alexandre Quessy 
> > Subject: Re: [Twisted-Python] Sending jpeg data over
> TCP/IP
> > To: "Twisted general discussion" 
> > Date: Sunday, February 14, 2010, 11:10 AM
> > Hello again everyone,
> > Maybe using two senders/receivers would help. The
> control
> > protocol,
> > which can use XML or JSON, or whatever, would identify
> the
> > files by
> > their md5 sum? The file transfert protocol would
> detect the
> > header of
> > each file to separate them.
> > 
> > a
> > 
> > gary clark wrote:
> > > There are probably several way to accomplish this
> I
> > just needed to think about it a wee bit longer. One
> way
> > would be to prepend an identifier to the file,strip
> the
> > header from the raw data on reception and then save
> the
> > image. I dont think its complicated. I may need a
> seperate
> > server to handle the files though.
> > > 
> > > Thanks,
> > > Garyc
> > > 
> > > --- On Sat, 2/13/10, Maarten ter Huurne 
> > wrote:
> > > 
> > >> From: Maarten ter Huurne 
> > >> Subject: Re: [Twisted-Python] Sending jpeg
> data
> > over TCP/IP
> > >> To: "Twisted general discussion" 
> > >> Date: Saturday, February 13, 2010, 6:07 PM
> > >> On Sunday 14 February 2010, Alexandre
> > >> Quessy wrote:
> > >>
> > >>> This said, sending them using a
> programmer's
> > solution
> > >> - not a sysadmin
> > >>> solution - would be closer to my own
> skills,
> > so I am
> > >> interested in
> > >>> knowing if this could be suitable. I
> think,
> > though,
> > >> that it would be
> > >>> faster to use a transfert protocol that
> would
> > be
> > >> implemented in C, not
> > >>> Python. Am I wrong?
> > >> I would suggest to implement it in Python
> first
> > and then
> > >> benchmark it. Maybe 
> > >> the simplest implementation is already fast
> > enough. Maybe
> > >> the bottleneck is 
> > >> the network or the disk you're writing to; in
> that
> > case you
> > >> would be better 
> > >> off upgrading your switches or buying an SSD
> > instead of
> > >> writing C code.
> > >>
> > >> Bye,
> > >>         Maarten
> > >>
> > >>
> ___
> > >> Twisted-Python mailing list
> > >> Twisted-Python@twistedmatrix.com
> > >> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> > >>
> > > 
> > > 
> > > ___
> > > Twisted-Python mailing list
> > > Twisted-Python@twistedmatrix.com
> > > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> > > 
> > 
> > ___
> > Twisted-Python mailing list
> > Twisted-Python@twistedmatrix.com
> > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> >
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Creating a daemon from my application

2010-03-15 Thread gary clark
Hello,

I want to create a twisted daemon from my application:

if __name__ == '__main__':
import nfdprocess, sys
log.startLogging(sys.stdout)
serverContext = ServerContextFactory()
serverContext.protocol = nfdprocess.HandlePacket
port =int(sys.argv[1])
checkT = checkTables()
checkT.resetTablesToOffline()
outgoingTable = LoopingCall(checkT.checkOutgoingMessageQueue,serverContext)
incomingTable = LoopingCall(checkT.checkIncomingMessageQueue,serverContext)
checkStates=  LoopingCall(checkT.checkConnectionStates,serverContext)
outgoingTable.start(0.5)
incomingTable.start(1)
checkStates.start(1)
reactor.listenSSL(port, serverContext, serverContext)
reactor.run()

Currently I have a class called nfdmessenger.

I am running the object.

> python nfdmessenger.py 2000

However I would run it as a deamon. Not sure how to do this? Can somebody be so 
kind and offer some pointers on this?

Much appreciated,
Garyc




___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Creating a daemon from my application

2010-03-15 Thread gary clark
Thanks Reza I wil give it a crack.

Much appreciated,
Garyc


--- On Mon, 3/15/10, Reza Lotun  wrote:

> From: Reza Lotun 
> Subject: Re: [Twisted-Python] Creating a daemon from my application
> To: "Twisted general discussion" 
> Date: Monday, March 15, 2010, 10:35 AM
> Hi,
> 
> > I want to create a twisted daemon from my application:
> ...
> 
> You want to use twistd. See
> http://twistedmatrix.com/documents/current/core/howto/basics.html#auto1
> 
> The process is roughly:
> 
> 1) create a myapp.tac file which essentially loads in your
> server and
> wraps it in an application
> 2) run something like:
>        $ twistd -r epoll -y
> myapp.tac
> which will daemonize your server (using the epoll reactor)
> and write
> its pid to twistd.pid
> 
> A .tac file could look something like:
> 
> from twisted.application import service, internet
> from myapp import MyAppServer
> 
> def get_service():
>     """ Return a service suitable for creating an
> application object. """
>     site = MyAppServer()
>     port = 2000
>     return internet.TCPServer(2000, site)
> 
> application = service.Application('MyApplicationName')
> # attach the service to its parent application
> service = get_service()
> service.setServiceParent(application)
> 
> Also, keep in mind you might want to use twistd in
> conjunction with a
> process runner (http://dustin.github.com/2010/02/28/running-processes.html).
> That is, if you're using something like Ubuntu, you
> probably want to
> run twistd using upstart.
> 
> Hope this helps.
> 
> Reza
> 
> -- 
> Reza Lotun
> mobile: +44 (0)7521 310 763
> email:  rlo...@gmail.com
> work:   r...@tweetdeck.com
> twitter: @rlotun
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Creating a daemon from my application

2010-03-15 Thread gary clark
Hello,

I compacted the server code initialization into the ServerContextFactory:


from nfdmessenger import ServerContextFactory
from twisted.internet import ssl, reactor


if __name__ == '__main__':
serverContext =  ServerContextFactory()
reactor.listenSSL(2000, serverContext, serverContext)
reactor.run()


Running the below:

python nfddaemon.py

Looks goods and runs as expected:


I then moved the code into a tac file:

from twisted.application import service,internet
from nfdmessenger import ServerContextFactory
from twisted.internet import ssl, reactor


def get_service():
serverContext =  ServerContextFactory()
return reactor.listenSSL(2000, serverContext, serverContext)

application=service.Application('nfdm')
service=get_service()
service.setServiceParent(application)


When I attempt to run:

>twistd -r epoll -y nfddaemon.tac

File "nfddaemon.tac", line 2, in 
from nfdmessenger import ServerContextFactory
exceptions.ImportError: No module named nfdmessenger

It looks like it cannot find the module? Do I have to set the path?
Also not too sure about my getService routine...well suspect.

Thanks,
Garyc

--- On Mon, 3/15/10, gary clark  wrote:

> From: gary clark 
> Subject: Re: [Twisted-Python] Creating a daemon from my application
> To: "Twisted general discussion" 
> Date: Monday, March 15, 2010, 11:14 AM
> Thanks Reza I wil give it a crack.
> 
> Much appreciated,
> Garyc
> 
> 
> --- On Mon, 3/15/10, Reza Lotun 
> wrote:
> 
> > From: Reza Lotun 
> > Subject: Re: [Twisted-Python] Creating a daemon from
> my application
> > To: "Twisted general discussion" 
> > Date: Monday, March 15, 2010, 10:35 AM
> > Hi,
> > 
> > > I want to create a twisted daemon from my
> application:
> > ...
> > 
> > You want to use twistd. See
> > http://twistedmatrix.com/documents/current/core/howto/basics.html#auto1
> > 
> > The process is roughly:
> > 
> > 1) create a myapp.tac file which essentially loads in
> your
> > server and
> > wraps it in an application
> > 2) run something like:
> >        $ twistd -r epoll -y
> > myapp.tac
> > which will daemonize your server (using the epoll
> reactor)
> > and write
> > its pid to twistd.pid
> > 
> > A .tac file could look something like:
> > 
> > from twisted.application import service, internet
> > from myapp import MyAppServer
> > 
> > def get_service():
> >     """ Return a service suitable for creating an
> > application object. """
> >     site = MyAppServer()
> >     port = 2000
> >     return internet.TCPServer(2000, site)
> > 
> > application =
> service.Application('MyApplicationName')
> > # attach the service to its parent application
> > service = get_service()
> > service.setServiceParent(application)
> > 
> > Also, keep in mind you might want to use twistd in
> > conjunction with a
> > process runner (http://dustin.github.com/2010/02/28/running-processes.html).
> > That is, if you're using something like Ubuntu, you
> > probably want to
> > run twistd using upstart.
> > 
> > Hope this helps.
> > 
> > Reza
> > 
> > -- 
> > Reza Lotun
> > mobile: +44 (0)7521 310 763
> > email:  rlo...@gmail.com
> > work:   r...@tweetdeck.com
> > twitter: @rlotun
> > 
> > ___
> > Twisted-Python mailing list
> > Twisted-Python@twistedmatrix.com
> > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> > 
> 
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Creating a daemon from my application

2010-03-15 Thread gary clark
Yeh I have to install them and create a setup.py to find the path.

--- On Mon, 3/15/10, gary clark  wrote:

> From: gary clark 
> Subject: Re: [Twisted-Python] Creating a daemon from my application
> To: "Twisted general discussion" 
> Date: Monday, March 15, 2010, 12:19 PM
> Hello,
> 
> I compacted the server code initialization into the
> ServerContextFactory:
> 
> 
> from nfdmessenger import ServerContextFactory
> from twisted.internet import ssl, reactor
> 
> 
> if __name__ == '__main__':
>     serverContext =  ServerContextFactory()
>     reactor.listenSSL(2000, serverContext,
> serverContext)
>     reactor.run()
> 
> 
> Running the below:
> 
> python nfddaemon.py
> 
> Looks goods and runs as expected:
> 
> 
> I then moved the code into a tac file:
> 
> from twisted.application import service,internet
> from nfdmessenger import ServerContextFactory
> from twisted.internet import ssl, reactor
> 
> 
> def get_service():
>     serverContext =  ServerContextFactory()
>     return reactor.listenSSL(2000, serverContext,
> serverContext)
> 
> application=service.Application('nfdm')
> service=get_service()
> service.setServiceParent(application)
> 
> 
> When I attempt to run:
> 
> >twistd -r epoll -y nfddaemon.tac
> 
> File "nfddaemon.tac", line 2, in 
>     from nfdmessenger import
> ServerContextFactory
> exceptions.ImportError: No module named nfdmessenger
> 
> It looks like it cannot find the module? Do I have to set
> the path?
> Also not too sure about my getService routine...well
> suspect.
> 
> Thanks,
> Garyc
> 
> --- On Mon, 3/15/10, gary clark 
> wrote:
> 
> > From: gary clark 
> > Subject: Re: [Twisted-Python] Creating a daemon from
> my application
> > To: "Twisted general discussion" 
> > Date: Monday, March 15, 2010, 11:14 AM
> > Thanks Reza I wil give it a crack.
> > 
> > Much appreciated,
> > Garyc
> > 
> > 
> > --- On Mon, 3/15/10, Reza Lotun 
> > wrote:
> > 
> > > From: Reza Lotun 
> > > Subject: Re: [Twisted-Python] Creating a daemon
> from
> > my application
> > > To: "Twisted general discussion" 
> > > Date: Monday, March 15, 2010, 10:35 AM
> > > Hi,
> > > 
> > > > I want to create a twisted daemon from my
> > application:
> > > ...
> > > 
> > > You want to use twistd. See
> > > http://twistedmatrix.com/documents/current/core/howto/basics.html#auto1
> > > 
> > > The process is roughly:
> > > 
> > > 1) create a myapp.tac file which essentially
> loads in
> > your
> > > server and
> > > wraps it in an application
> > > 2) run something like:
> > >        $ twistd -r epoll -y
> > > myapp.tac
> > > which will daemonize your server (using the
> epoll
> > reactor)
> > > and write
> > > its pid to twistd.pid
> > > 
> > > A .tac file could look something like:
> > > 
> > > from twisted.application import service,
> internet
> > > from myapp import MyAppServer
> > > 
> > > def get_service():
> > >     """ Return a service suitable for creating
> an
> > > application object. """
> > >     site = MyAppServer()
> > >     port = 2000
> > >     return internet.TCPServer(2000, site)
> > > 
> > > application =
> > service.Application('MyApplicationName')
> > > # attach the service to its parent application
> > > service = get_service()
> > > service.setServiceParent(application)
> > > 
> > > Also, keep in mind you might want to use twistd
> in
> > > conjunction with a
> > > process runner 
> > > (http://dustin.github.com/2010/02/28/running-processes.html).
> > > That is, if you're using something like Ubuntu,
> you
> > > probably want to
> > > run twistd using upstart.
> > > 
> > > Hope this helps.
> > > 
> > > Reza
> > > 
> > > -- 
> > > Reza Lotun
> > > mobile: +44 (0)7521 310 763
> > > email:  rlo...@gmail.com
> > > work:   r...@tweetdeck.com
> > > twitter: @rlotun
> > > 
> > > ___
> > > Twisted-Python mailing list
> > > Twisted-Python@twistedmatrix.com
> > > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> > > 
> > 
> > 
> > ___
> > Twisted-Python mailing list
> > Twisted-Python@twistedmatrix.com
> > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> > 
> 
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Creating a daemon from my application

2010-03-15 Thread gary clark
Hello,


twistd -r epoll -y ./nfddaemon.tac

The below is the .tac file:

from twisted.application import service,internet
from nfdmessenger import ServerContextFactory
from twisted.internet import ssl, reactor


def get_service():
serverContext =  ServerContextFactory()
return reactor.listenSSL(2000, serverContext, serverContext)

application=service.Application('nfdm')
service=get_service()
service.setServiceParent(application)

Not sure what to do at this point. It runs and then dies, doing something wrong 
in getService() dont know ehat the correct syntax is:

File "./nfddaemon.tac", line 12, in 
service.setServiceParent(application)
exceptions.AttributeError: 'Port' object has no attribute 
'setServiceParent'

Thanks,
Garyc



--- On Mon, 3/15/10, Reza Lotun  wrote:

> From: Reza Lotun 
> Subject: Re: [Twisted-Python] Creating a daemon from my application
> To: "Twisted general discussion" 
> Date: Monday, March 15, 2010, 1:15 PM
> On Mon, Mar 15, 2010 at 6:03 PM, gary
> clark 
> wrote:
> > Yeh I have to install them and create a setup.py to
> find the path.
> 
> You only need to set your PYTHONPATH environment variable.
> 
> e.g.
> 
> $ export PYTHONPATH=/path/to/dir/containing/code
> 
> -- 
> Reza Lotun
> mobile: +44 (0)7521 310 763
> email:  rlo...@gmail.com
> work:   r...@tweetdeck.com
> twitter: @rlotun
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Creating a daemon from my application

2010-03-15 Thread gary clark
Ok the below works:

from twisted.application import service,internet
from nfdmessenger import ServerContextFactory
from twisted.internet import ssl, reactor


def get_service():
serverContext =  ServerContextFactory()
return internet.SSLServer(2000, serverContext)

application=service.Application('nfdm')
service=get_service()
service.setServiceParent(application)


--- On Mon, 3/15/10, gary clark  wrote:

> From: gary clark 
> Subject: Re: [Twisted-Python] Creating a daemon from my application
> To: "Twisted general discussion" 
> Date: Monday, March 15, 2010, 3:42 PM
> Hello,
> 
> 
> twistd -r epoll -y ./nfddaemon.tac
> 
> The below is the .tac file:
> 
> from twisted.application import service,internet
> from nfdmessenger import ServerContextFactory
> from twisted.internet import ssl, reactor
> 
> 
> def get_service():
>     serverContext =  ServerContextFactory()
>     return reactor.listenSSL(2000, serverContext,
> serverContext)
> 
> application=service.Application('nfdm')
> service=get_service()
> service.setServiceParent(application)
> 
> Not sure what to do at this point. It runs and then dies,
> doing something wrong in getService() dont know ehat the
> correct syntax is:
> 
> File "./nfddaemon.tac", line 12, in 
>        
> service.setServiceParent(application)
>     exceptions.AttributeError: 'Port' object
> has no attribute 'setServiceParent'
> 
> Thanks,
> Garyc
> 
> 
> 
> --- On Mon, 3/15/10, Reza Lotun 
> wrote:
> 
> > From: Reza Lotun 
> > Subject: Re: [Twisted-Python] Creating a daemon from
> my application
> > To: "Twisted general discussion" 
> > Date: Monday, March 15, 2010, 1:15 PM
> > On Mon, Mar 15, 2010 at 6:03 PM, gary
> > clark 
> > wrote:
> > > Yeh I have to install them and create a setup.py
> to
> > find the path.
> > 
> > You only need to set your PYTHONPATH environment
> variable.
> > 
> > e.g.
> > 
> > $ export PYTHONPATH=/path/to/dir/containing/code
> > 
> > -- 
> > Reza Lotun
> > mobile: +44 (0)7521 310 763
> > email:  rlo...@gmail.com
> > work:   r...@tweetdeck.com
> > twitter: @rlotun
> > 
> > ___
> > Twisted-Python mailing list
> > Twisted-Python@twistedmatrix.com
> > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> > 
> 
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Creating a daemon from my application

2010-03-15 Thread gary clark
from twisted.application import service,internet
from nfdmessenger import ServerContextFactory
from twisted.internet import ssl, reactor


def get_service():
serverContext =  ServerContextFactory()
return internet.SSLServer(2000, serverContext,serverContext)

application=service.Application('nfdm')
service=get_service()
service.setServiceParent(application)

Thats better.



--- On Mon, 3/15/10, gary clark  wrote:

> From: gary clark 
> Subject: Re: [Twisted-Python] Creating a daemon from my application
> To: "Twisted general discussion" 
> Date: Monday, March 15, 2010, 4:00 PM
> Ok the below works:
> 
> from twisted.application import service,internet
> from nfdmessenger import ServerContextFactory
> from twisted.internet import ssl, reactor
> 
> 
> def get_service():
>     serverContext =  ServerContextFactory()
>     return internet.SSLServer(2000,
> serverContext)
> 
> application=service.Application('nfdm')
> service=get_service()
> service.setServiceParent(application)
> 
> 
> --- On Mon, 3/15/10, gary clark 
> wrote:
> 
> > From: gary clark 
> > Subject: Re: [Twisted-Python] Creating a daemon from
> my application
> > To: "Twisted general discussion" 
> > Date: Monday, March 15, 2010, 3:42 PM
> > Hello,
> > 
> > 
> > twistd -r epoll -y ./nfddaemon.tac
> > 
> > The below is the .tac file:
> > 
> > from twisted.application import service,internet
> > from nfdmessenger import ServerContextFactory
> > from twisted.internet import ssl, reactor
> > 
> > 
> > def get_service():
> >     serverContext =  ServerContextFactory()
> >     return reactor.listenSSL(2000, serverContext,
> > serverContext)
> > 
> > application=service.Application('nfdm')
> > service=get_service()
> > service.setServiceParent(application)
> > 
> > Not sure what to do at this point. It runs and then
> dies,
> > doing something wrong in getService() dont know ehat
> the
> > correct syntax is:
> > 
> > File "./nfddaemon.tac", line 12, in 
> >        
> > service.setServiceParent(application)
> >     exceptions.AttributeError: 'Port' object
> > has no attribute 'setServiceParent'
> > 
> > Thanks,
> > Garyc
> > 
> > 
> > 
> > --- On Mon, 3/15/10, Reza Lotun 
> > wrote:
> > 
> > > From: Reza Lotun 
> > > Subject: Re: [Twisted-Python] Creating a daemon
> from
> > my application
> > > To: "Twisted general discussion" 
> > > Date: Monday, March 15, 2010, 1:15 PM
> > > On Mon, Mar 15, 2010 at 6:03 PM, gary
> > > clark 
> > > wrote:
> > > > Yeh I have to install them and create a
> setup.py
> > to
> > > find the path.
> > > 
> > > You only need to set your PYTHONPATH environment
> > variable.
> > > 
> > > e.g.
> > > 
> > > $ export PYTHONPATH=/path/to/dir/containing/code
> > > 
> > > -- 
> > > Reza Lotun
> > > mobile: +44 (0)7521 310 763
> > > email:  rlo...@gmail.com
> > > work:   r...@tweetdeck.com
> > > twitter: @rlotun
> > > 
> > > ___
> > > Twisted-Python mailing list
> > > Twisted-Python@twistedmatrix.com
> > > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> > > 
> > 
> > 
> > ___
> > Twisted-Python mailing list
> > Twisted-Python@twistedmatrix.com
> > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> > 
> 
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] twistd and init.d

2010-04-21 Thread gary clark
I have written an init.d script thats starts and stops a twistd. You need to 
create a .tac file and create a daemon. A wee bit more tricky but you can start 
twistd fine.

Thanks,
Garyc

--- On Wed, 4/21/10, Tim Allen  wrote:

> From: Tim Allen 
> Subject: Re: [Twisted-Python] twistd and init.d
> To: "Twisted general discussion" 
> Date: Wednesday, April 21, 2010, 7:16 AM
> On Wed, Apr 21, 2010 at 01:38:09PM
> +0200, Don Schoeman wrote:
> >    This works fine when running
> /etc/init.d/ghserver start and
> >    /etc/init.d/ghserver stop. The script
> also run when I boot since the
> >    logger actually logs the "GHServer:
> Starting" text to the
> >    /var/log/messages file. However, my
> service actually does not start. There
> >    is no pid to be found anywhere, there are
> no error logs anywhere, just
> >    nothing. I might be doing something wrong
> here but is there someone who's
> >    gone through this process and can provide
> some samples how they did it?
> 
> I haven't written an init-script for twistd myself, I just
> use the one
> auto-generated by tap2rpm. You can compare your script to
> the template
> tap2rpm uses and see if that gives you any clues:
> 
>     
> http://twistedmatrix.com/trac/browser/trunk/twisted/scripts/tap2rpm.py#L17 
>   
> It surprises me that you say you can tell that the script
> runs at boot
> because you can see it in /var/log/messages - although most
> Linux
> distros hide the boot-script messages by default, they
> usually provide
> a way to display them for debugging purposes such as these
> (different
> distributions use different actions to trigger boot
> messages; if you
> can't find instructions for your distribution online, you
> might try
> hitting Escape a few times at different parts of the boot
> sequence).
> 
> Finally, in my limited experience of diagnosing scripts
> that work from
> an interactive shell but not at boot time, you might want
> to look for
> code that uses environment variables. $EMPLOYER once had
> some scripts
> that got some particular setting from an environment
> variable that was
> only set by interactive shells - so if you ssh'd to the
> machine and ran
> the code, it'd be fine, but it crashed when run at bootup.
> 
> CentOS (and perhaps other Linux distributions) has a tool
> called
> /sbin/service. If you run "/sbin/service ghserver start"
> rather than
> "/etc/init.d/ghserver start", /sbin/service will start the
> service in
> a clean, boot-like environment and you might get more
> debugging clues
> that way.
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] twistd and init.d

2010-04-21 Thread gary clark

My understanding is the twistd will have a default log twistd.log. 
 
Thanks,
Garyc

--- On Wed, 4/21/10, Don Schoeman  wrote:


From: Don Schoeman 
Subject: Re: [Twisted-Python] twistd and init.d
To: "Twisted general discussion" 
Date: Wednesday, April 21, 2010, 7:54 AM


Sorry, I mean't to say I will use the full path to twistd (i.e. 
/usr/bin/twistd) and see if that works.

Don Schoeman wrote: 
Thanks for the tips guys,

Maartin, I have a feeling that you may be correct. I'm going to see if I can't 
set the python path within the script.

Tim, the only reason I can see anything in  /var/logs/messages is because I use 
the "logger" tool to log those messages directly from the bash shell script. 
See the script below.

Kind Regards,
Don


Don Schoeman wrote: 
Hi guys,

My application is being executed using twistd as per documentation. All is 
working fine but I need to have the service start automatically at boot time.

So as a test I've created a script in /etc/init.d/ which looks like this:

#! /bin/sh
### BEGIN INIT INFO
# Provides:  ghserver
# Required-Start:    $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop:  0 1 6
# Short-Description: Start/stop GHServer server
### END INIT INFO

logger "GHServer: Start script executed"
GH_SERVER_PATH="/home/myname/Python/ghserver"
export PYTHONPATH="$GH_SERVER_PATH:$PYTHONPATH"

case "$1" in
  start)
    logger "GHServer: Starting"
    echo "Starting GHServer..."
    twistd -y "$GH_SERVER_PATH/ghserverapp.py" -l 
"$GH_SERVER_PATH/ghserver.log" --pidfile "$GH_SERVER_PATH/twistd.pid"
    ;;
  stop)
    logger "GHServer: Stopping"
    echo "Stopping GHServer..."
    kill `cat $GH_SERVER_PATH/twistd.pid`
    ;;
  *)
    logger "GHServer: Invalid usage"
    echo "Usage: /etc/init.d/ghserver {start|stop}"
    exit 1
    ;;
esac

exit 0


This works fine when running /etc/init.d/ghserver start and 
/etc/init.d/ghserver stop. The script also run when I boot since the logger 
actually logs the "GHServer: Starting" text to the /var/log/messages file. 
However, my service actually does not start. There is no pid to be found 
anywhere, there are no error logs anywhere, just nothing. I might be doing 
something wrong here but is there someone who's gone through this process and 
can provide some samples how they did it? Any help will be greatly appreciated.

Kind Regards,
Don



___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
  
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
  
-Inline Attachment Follows-


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] python and twisted and openssl

2010-04-21 Thread gary clark
Hey Guys,

I apologise in advance but this is is not the correct platform.

Essentially I'm porting my server to a new VPS and the platform is enough to 
cause
me headaches to resurrect my twisted server.

I'm using open-ssl however I'm seeing mismatches:

[r...@1003100u6h1z pyOpenSSL-0.9]# python 
Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38) 
[GCC 4.3.2 20080917 (Red Hat 4.3.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import OpenSSL
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python2.5/site-packages/OpenSSL/__init__.py", line 11, 
in 
    import rand, crypto, SSL, tsafe
ImportError: /usr/local/lib/python2.5/site-packages/OpenSSL/crypto.so: 
undefined symbol: PyUnicodeUCS2_Decode

What is this PyUnicodeUCS2_Decode? Has anybody else seen this blighter?

Thanks,
Garyc


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] python and twisted and openssl

2010-04-21 Thread gary clark

Much appreciated Glyph. I thought it would be a common problem.
Just didnt know which group to ask.

--- On Wed, 4/21/10, Glyph Lefkowitz  wrote:

> From: Glyph Lefkowitz 
> Subject: Re: [Twisted-Python] python and twisted and openssl
> To: "Twisted general discussion" 
> Date: Wednesday, April 21, 2010, 7:13 PM
> 
> On Apr 21, 2010, at 2:47 PM, gary clark wrote:
> 
> > undefined symbol: PyUnicodeUCS2_Decode
> 
> > What is this PyUnicodeUCS2_Decode? Has anybody else
> seen this blighter?
> 
> When you build Python, you either build its Unicode support
> with support for UCS2 (2-byte, 16-bit code points) or UCS4
> (4-byte, 32-bit code points).  Extension modules must
> be built in the same configuration as the Python interpreter
> in order to be loaded and dynamically linked correctly,
> since UCS4 python is missing the UCS2 symbols and vice
> versa.
> 
> It looks like you have a UCS4 python and a UCS2
> PyOpenSSL.  You need to re-build PyOpenSSL against the
> Python installation that you are using, or at least one
> built with the same options.
> 
> This is a pretty common build problem; if you search for
> mailing list threads about it on python-list or python-dev
> you should find plenty.
> 
> Good luck,
> 
> -glyph
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] That's why there are so many good reviews

2019-01-16 Thread Gary Clark
Durable solution http://kind.ourchaoscandidate.com 
<http://kind.ourchaoscandidate.com/> 

 

 

Gary Clark

 

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
https://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] problems with transport.write

2011-04-28 Thread gary clark
Hiya,
 
I have created a client-server application which uses ssl to communicate.
 
I am trying to determine if its the server or client. However its definetly 
sending a string in the connection.transport.write to the target client.
 
The majority of the time is sends and receives, but occasionally it fails.
Is there a way (other than the client sending an ACK with a sequence number in 
it) to know if the write was successful and if not resend.
 
Much appreciated,
Gary C
 
 
 


--- On Thu, 4/28/11, Andrey Smirnov  wrote:


From: Andrey Smirnov 
Subject: Re: [Twisted-Python] [ANN] txZMQ released
To: "Twisted general discussion" 
Date: Thursday, April 28, 2011, 7:53 AM


Yes, I'll drop it as soon as I won't need it anymore (probably in one week).


2011/4/28 Laurens Van Houtven <_...@lvh.cc>

Yeah, I saw that one and got confused. Just to be clear, I'm supposed to ignore 
your pyzmq fork, right?

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python




-- 
Andrey Smirnov,
Qik Web Team Lead

-Inline Attachment Follows-


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] problems with transport.write

2011-04-28 Thread gary clark
Much appreciated on the quick response.

It fails by writing a large string at the server side and not receiving any 
data at the client. The client uses open-ssl and is blocking to receive data. I 
dont know if its possible to determine if the write was successful or not on 
the server side i.e knowing how many bytes were written etc. I dont see any 
exceptions. The connection is still maintained and like I said its 
intermittent. So when a transport.write occurs is there an api I can use to see 
if it was successful?

I'm trying to isolate if its a server problem or a client issue at the moment.

Thanks,

Gary C

--- On Thu, 4/28/11, Glyph Lefkowitz  wrote:

> From: Glyph Lefkowitz 
> Subject: Re: [Twisted-Python] problems with transport.write
> To: "Twisted general discussion" 
> Date: Thursday, April 28, 2011, 6:43 PM
> 
> On Apr 28, 2011, at 4:18 PM, gary clark wrote:
> 
> > Hiya,
> >  
> > I have created a client-server application which uses
> ssl to communicate.
> >  
> > I am trying to determine if its the server or client.
> However its definetly sending a string in the
> connection.transport.write to the target client.
> 
> Trying to determine what is the server or the client?
> 
> > The majority of the time is sends and receives, but
> occasionally it fails.
> 
> Fails how?
> 
> > Is there a way (other than the client sending an ACK
> with a sequence number in it) to know if the write was
> successful and if not resend.
> 
> If you're using SSL, then you're using TCP, which
> transparently _does_ send an ACK with a sequence number in
> it.  You never have to re-send TCP segments at the
> application layer, that would result in a stream with
> duplicate data in it.
> 
> Please be more specific about the problem you're having, so
> we can find an answer :).
> 
> -g
> 
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Failure to connect remotely to MySQL database

2011-06-16 Thread gary clark
Hello,

I am trying to connect a twisted server to a remote machine which contains the 
mysql database, unfortunately I cannot access the database am am seeing error:

Failed to load application: Cant connect to MySQL on server 192.168.1.10.

db=create_engine('mysql://root:pwd@192.168.1.10/database',echo=True)

The databse machine has a number of restrictions on the firewall. I can ping 
the database machine and can see the that mysqld is running and enabled. What 
need to be open and enabled to access the mysql server from another machine i.e 
what port and connection type.

I dont see anything in the mysqld log.

Cheers,
Gary C


___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Failure to connect remotely to MySQL database

2011-06-16 Thread gary clark
OK needed to allow port 3306 for mysql. Grant accesses on the database.

Thanks,
Gary C


--- On Thu, 6/16/11, gary clark  wrote:

> From: gary clark 
> Subject: [Twisted-Python] Failure to connect remotely to MySQL database
> To: "Twisted general discussion" 
> Date: Thursday, June 16, 2011, 5:46 PM
> Hello,
> 
> I am trying to connect a twisted server to a remote machine
> which contains the mysql database, unfortunately I cannot
> access the database am am seeing error:
> 
> Failed to load application: Cant connect to MySQL on server
> 192.168.1.10.
> 
> db=create_engine('mysql://root:pwd@192.168.1.10/database',echo=True)
> 
> The databse machine has a number of restrictions on the
> firewall. I can ping the database machine and can see the
> that mysqld is running and enabled. What need to be open and
> enabled to access the mysql server from another machine i.e
> what port and connection type.
> 
> I dont see anything in the mysqld log.
> 
> Cheers,
> Gary C
> 
> 
> ___
> Twisted-Python mailing list
> Twisted-Python@twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
> 

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] ugh open-ssl and twisted python

2013-07-27 Thread gary clark
Hello,
 
This problem has been driving me crazy for a couple of days. I'm hoping someone 
can shed some light
on this. I have a twisted server its using open-ssl (using certificates) and 
runs on linux and communicates great with a windows client thats send messages 
every second.
 
However when I send data back to the client "sometimes" it doesnt receive the 
packet and there is no indication of failure at the client whats more I dont 
see any failure on the twisted server end. Is there any way I can tell what 
could cause this failure? It just look like the transport.write(data) fails 
just dont know why it would when receiving works like a charm.
 
Any help on this would relieve the pain I'm feeling right now.
 
Much Appreciated,
Gazza___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] ugh open-ssl and twisted python

2013-07-27 Thread gary clark
Guys,
 
Its the MTU size. Anything bigger than 1500 bytes is getting fragmented.
Using wireshark I'm seeing TCP Previous segment lost anything bigger than 1500. 
However once that
happens things go south and remain there.
 
Oh boy one day I will learn but not today.
 
Cheers,
Gazza
 
From: "exar...@twistedmatrix.com" 
To: Twisted general discussion  
Sent: Saturday, July 27, 2013 12:27 PM
Subject: Re: [Twisted-Python] ugh open-ssl and twisted python


On 04:08 pm, burslem2...@yahoo.com wrote:
> Hello,
> 
> This problem has been driving me crazy for a couple of days. I'm hoping 
> someone can shed some light
> on this. I have a twisted server its using open-ssl (using certificates) and 
> runs on linux and communicates great with a windows client thats send 
> messages every second.
> 
> However when I send data back to the client "sometimes" it doesnt receive the 
> packet and there is no indication of failure at the client whats more I dont 
> see any failure on the twisted server end. Is there any way I can tell what 
> could cause this failure? It just look like the transport.write(data) fails 
> just dont know why it would when receiving works like a charm.
> 
> Any help on this would relieve the pain I'm feeling right now.

Please see http://sscce.org/

Jean-Paul

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] ugh open-ssl and twisted python

2013-07-27 Thread gary clark
Ok split my data up into smaller fragments. It still look like its reassembing 
the whole payload
before sending it to the client. I'm calling transport.write(partdata) multiple 
times with a 0.5 second delay running in a twisted thread. How can I force the 
write to happen straight away in twisted.
 
Sorry for all the questions.
 
Thanks,
Gazza

From: gary clark 
To: Twisted general discussion  
Sent: Saturday, July 27, 2013 12:36 PM
Subject: Re: [Twisted-Python] ugh open-ssl and twisted python



Guys,

Its the MTU size. Anything bigger than 1500 bytes is getting fragmented.
Using wireshark I'm seeing TCP Previous segment lost anything bigger than 1500. 
However once that
happens things go south and remain there.

Oh boy one day I will learn but not today.

Cheers,
Gazza

From: "exar...@twistedmatrix.com" 
To: Twisted general discussion  
Sent: Saturday, July 27, 2013 12:27 PM
Subject: Re: [Twisted-Python] ugh open-ssl and twisted python


On 04:08 pm, burslem2...@yahoo.com wrote:
> Hello,
> 
> This problem has been driving me crazy for a couple of days. I'm hoping 
> someone can shed some light
> on this. I have a twisted server its using open-ssl (using certificates) and 
> runs on linux and communicates great with a windows client thats send 
> messages every second.
> 
> However when I send data back to the client "sometimes" it doesnt receive the 
> packet and there is no indication of failure at the client whats more I dont 
> see any failure on the twisted server end. Is there any way I can tell what 
> could cause this failure? It just look like the transport.write(data) fails 
> just dont know why it would when receiving works like a charm.
> 
> Any help on this would relieve the pain I'm feeling right now.

Please see http://sscce.org/

Jean-Paul

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python



___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] ugh open-ssl and twisted python

2013-07-27 Thread gary clark
Ok finally fixed the damn thing. I made the packets smaller and created a task 
in the .tac file to call a  routine that send the message parts piece by piece.
 
Thanks,
Gazza

From: gary clark 
To: gary clark ; Twisted general discussion 
; Twisted general discussion 
 
Sent: Saturday, July 27, 2013 2:38 PM
Subject: Re: [Twisted-Python] ugh open-ssl and twisted python



Ok split my data up into smaller fragments. It still look like its reassembing 
the whole payload
before sending it to the client. I'm calling transport.write(partdata) multiple 
times with a 0.5 second delay running in a twisted thread. How can I force the 
write to happen straight away in twisted.
 
Sorry for all the questions.
 
Thanks,
Gazza

From: gary clark 
To: Twisted general discussion  
Sent: Saturday, July 27, 2013 12:36 PM
Subject: Re: [Twisted-Python] ugh open-ssl and twisted python



Guys,

Its the MTU size. Anything bigger than 1500 bytes is getting fragmented.
Using wireshark I'm seeing TCP Previous segment lost anything bigger than 1500. 
However once that
happens things go south and remain there.

Oh boy one day I will learn but not today.

Cheers,
Gazza

From: "exar...@twistedmatrix.com" 
To: Twisted general discussion  
Sent: Saturday, July 27, 2013 12:27 PM
Subject: Re: [Twisted-Python] ugh open-ssl and twisted python


On 04:08 pm, burslem2...@yahoo.com wrote:
> Hello,
> 
> This problem has been driving me crazy for a couple of days. I'm hoping 
> someone can shed some light
> on this. I have a twisted server its using open-ssl (using certificates) and 
> runs on linux and communicates great with a windows client thats send 
> messages every second.
> 
> However when I send data back to the client "sometimes" it doesnt receive the 
> packet and there is no indication of failure at the client whats more I dont 
> see any failure on the twisted server end. Is there any way I can tell what 
> could cause this failure? It just look like the transport.write(data) fails 
> just dont know why it would when receiving works like a charm.
> 
> Any help on this would relieve the pain I'm feeling right now.

Please see http://sscce.org/

Jean-Paul

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python



___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python