Ejemplo n.º 1
0
 def outReceived(self, data):
     try:
         print("Process out " + data, file=stderr)
     except UnicodeDecodeError:
         print("Process out (unicodeerror)", file=stderr)
     for line in b(data).strip().split(b('\n')):
         line = self.filterout(line.strip())
         if self.currentclient and line:
             self.currentclient.sendLine(line)
Ejemplo n.º 2
0
 def outReceived(self, data):
     try:
         print("Process out " + data,file=stderr)
     except UnicodeDecodeError:
         print("Process out (unicodeerror)",file=stderr)
     for line in b(data).strip().split(b('\n')):
         line = self.filterout(line.strip())
         if self.currentclient and line:
             self.currentclient.sendLine(line)
Ejemplo n.º 3
0
 def errReceived(self, data):
     try:
         print("Process err " + data, file=stderr)
     except UnicodeDecodeError:
         print("Process out (unicodeerror)", file=stderr)
     if self.printstderr and data:
         print(data.strip(), file=stderr)
     for line in b(data).strip().split(b("\n")):
         line = self.filtererr(line.strip())
         if self.sendstderr and self.currentclient and line:
             self.currentclient.sendLine(line)
Ejemplo n.º 4
0
 def outReceived(self, data):
     try:
         if sys.version >= '3' and isinstance(data, bytes):
             print("Process out " + str(data, 'utf-8'), file=stderr)
         else:
             print("Process out " + data, file=stderr)
     except UnicodeDecodeError:
         print("Process out (unicodeerror)", file=stderr)
     print("DEBUG:", repr(b(data).strip().split(b('\n'))))
     for line in b(data).strip().split(b('\n')):
         line = self.filterout(line.strip())
         if self.currentclient and line:
             self.currentclient.sendLine(b(line))
Ejemplo n.º 5
0
 def outReceived(self, data):
     try:
         if sys.version >= '3' and isinstance(data,bytes):
             print("Process out " + str(data, 'utf-8'),file=stderr)
         else:
             print("Process out " + data,file=stderr)
     except UnicodeDecodeError:
         print("Process out (unicodeerror)",file=stderr)
     print("DEBUG:", repr(b(data).strip().split(b('\n'))))
     for line in b(data).strip().split(b('\n')):
         line = self.filterout(line.strip())
         if self.currentclient and line:
             self.currentclient.sendLine(b(line))
Ejemplo n.º 6
0
 def errReceived(self, data):
     try:
         if sys.version >= '3' and isinstance(data, bytes):
             print("Process err " + str(data, 'utf-8'), file=sys.stderr)
         else:
             print("Process err " + data, file=stderr)
     except UnicodeDecodeError:
         print("Process out (unicodeerror)", file=stderr)
     if self.printstderr and data:
         print(data.strip(), file=stderr)
     for line in b(data).strip().split(b('\n')):
         line = self.filtererr(line.strip())
         if self.sendstderr and self.currentclient and line:
             self.currentclient.sendLine(b(line))
Ejemplo n.º 7
0
 def errReceived(self, data):
     try:
         if sys.version >= '3' and isinstance(data,bytes):
             print("Process err " + str(data,'utf-8'), file=sys.stderr)
         else:
             print("Process err " + data,file=stderr)
     except UnicodeDecodeError:
         print("Process out (unicodeerror)",file=stderr)
     if self.printstderr and data:
         print(data.strip(),file=stderr)
     for line in b(data).strip().split(b('\n')):
         line = self.filtererr(line.strip())
         if self.sendstderr and self.currentclient and line:
             self.currentclient.sendLine(b(line))
Ejemplo n.º 8
0
 def lineReceived(self, line):
     try:
         print("Client in: " + line, file=stderr)
     except UnicodeDecodeError:
         print("Client in: (unicodeerror)", file=stderr)
     if sys.version < "3":
         if isinstance(line, unicode):
             self.factory.processprotocol.transport.write(line.encode("utf-8"))
         else:
             self.factory.processprotocol.transport.write(line)
         self.factory.processprotocol.transport.write(b("\n"))
     else:
         self.factory.processprotocol.transport.write(b(line + "\n"))
     self.factory.processprotocol.currentclient = self
Ejemplo n.º 9
0
 def lineReceived(self, line):
     try:
         print("Client in: " + line, file=stderr)
     except UnicodeDecodeError:
         print("Client in: (unicodeerror)", file=stderr)
     if sys.version < '3':
         if isinstance(line, unicode):
             self.factory.processprotocol.transport.write(
                 line.encode('utf-8'))
         else:
             self.factory.processprotocol.transport.write(line)
         self.factory.processprotocol.transport.write(b('\n'))
     else:
         self.factory.processprotocol.transport.write(b(line + '\n'))
     self.factory.processprotocol.currentclient = self
Ejemplo n.º 10
0
 def connectionMade(self):
     print("Client connected", file=stderr)
     self.factory.connections += 1
     if self.factory.connections < 1:
         self.transport.loseConnection()
     else:
         self.sendLine(b("READY"))
Ejemplo n.º 11
0
 def lineReceived(self, line):
     try:
         print("Client in: " + line,file=stderr)
     except UnicodeDecodeError:
         print("Client in: (unicodeerror)",file=stderr)
     self.factory.processprotocol.transport.write(b(line +'\n'))
     self.factory.processprotocol.currentclient = self
Ejemplo n.º 12
0
 def connectionMade(self):
     print("Client connected", file=stderr)
     self.factory.connections += 1
     if self.factory.connections != 1:
         self.transport.loseConnection()
     else:
         self.sendLine(b("READY"))
Ejemplo n.º 13
0
Archivo: net.py Proyecto: sdhu/pynlpl
 def lineReceived(self, line):
     try:
         print("Client in: " + line, file=stderr)
     except UnicodeDecodeError:
         print("Client in: (unicodeerror)", file=stderr)
     self.factory.processprotocol.transport.write(b(line + '\n'))
     self.factory.processprotocol.currentclient = self
Ejemplo n.º 14
0
 def lineReceived(self, line):
     try:
         if sys.version >= '3' and isinstance(line,bytes):
             print("Client in: " + str(line,'utf-8'),file=stderr)
         else:
             print("Client in: " + line,file=stderr)
     except UnicodeDecodeError:
         print("Client in: (unicodeerror)",file=stderr)
     if sys.version < '3':
         if isinstance(line,unicode):
             self.factory.processprotocol.transport.write(line.encode('utf-8'))
         else:
             self.factory.processprotocol.transport.write(line)
         self.factory.processprotocol.transport.write(b('\n'))
     else:
         self.factory.processprotocol.transport.write(b(line) + b('\n'))
     self.factory.processprotocol.currentclient = self