/usr/share/pyshared/ControlAula/testControlProtocol.py is in ltsp-controlaula 1.8.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
##############################################################################
# Project: Controlaula
# Module: testControlProtocol.py
# Purpose: Test module for ClassProtocol
# Language: Python 2.6
# Date: 21-Jan-2012.
# Ver: 27-Jan-2012.
# Author: José L. Redrejo Rodríguez
# Copyright: 2009-2012 - José L. Redrejo Rodríguez <jredrejo @nospam@ debian.org>
#
# ControlAula is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# ControlAula is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with ControlAula. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from twisted.internet import reactor
from twisted.internet.protocol import ReconnectingClientFactory
from ClassProtocol import ControlProtocol
Con = None
class ControlFactory(ReconnectingClientFactory):
"""Look at
http://twistedmatrix.com/trac/browser/tags/releases/\
twisted-8.2.0/twisted/internet/protocol.py
for more info on this ReconnectClientFactory"""
protocol = ControlProtocol
def connectionFailed(reason):
print reason
reactor.stop()
return
def conectar():
global con
f = ControlFactory()
iCon=reactor.connectTCP("172.16.3.207", 8901, f)
#iCon = reactor.connectTCP("127.0.0.1", 8901, f)
def connected(protocol):
if protocol:
#doMath(protocol)
pass
else:
try:
reactor.stop()
except:
pass # reactor was already stopped
return
if __name__ == '__main__':
reactor.callWhenRunning(conectar)
reactor.run()
|