Hello. I want to decode the output of a command launched with subprocess.check_output. Which encoding should I use? sys.stdout.encoding? sys.getdefaultencoding()? sys.getfilesystemencoding()? Others?
we create a FileSender(), tell it to send an open file over the connection (transport) over which we're running, then arrange for the file to be closed and the connection closed when the transfer completes, successfully or not
by using FileSender, many different clients could request files simultaneously, and each would receive its file incrementally, without blocking the others
my dataReceived looks like this. https://repl.it/HjP0 Rarely client does not get echo back. Is twisted losing connection before it will write all data to client?
glyph
RandomNoob: are you using TLS?
RandomNoob
glyph: Nope. Just tcp
reactor.listenTCP(TCP_PORT, EchoFactory())
reactor.run(installSignalHandlers=False) # As I am running it in the thread
runciter
whoa why are you running it in a thread??
RandomNoob
I have web app running with apache2
I also have few more threads
as twisted locks while True
I cant deal with it. I am reading twisted docs right now and adding it to my project which already in production
have no time for big changes.
runciter
what are you using twisted for?
i'd recommend running it in its own process, separate from apache2
RandomNoob
as TCP server.
runciter
or, you could look into crochet
RandomNoob: where do you spawn that thread?
RandomNoob
runciter: I look closely with crochet
runciter
RandomNoob: there's no concept of a startup or shutdown sequence with modwsgi
RandomNoob
in wsgi process. I am also using Sqlalchemy.
runciter
RandomNoob: that means every single python process/thread will attempt to spawn the server
that will lead to some weird results
i definitely suggest just running twisted in a separate process
RandomNoob
How do you think to implement it?
give me advice
runciter
can you tell me more about what you'd like to accomplish?
RandomNoob
I have lots of clients which are sending me data via TCP.