DebugClients/Python/AsyncIO.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1509
c0b5e693b0eb
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
26 Public method to disconnect any current connection. 26 Public method to disconnect any current connection.
27 """ 27 """
28 self.readfd = None 28 self.readfd = None
29 self.writefd = None 29 self.writefd = None
30 30
31 def setDescriptors(self,rfd,wfd): 31 def setDescriptors(self, rfd, wfd):
32 """ 32 """
33 Public method called to set the descriptors for the connection. 33 Public method called to set the descriptors for the connection.
34 34
35 @param rfd file descriptor of the input file (int) 35 @param rfd file descriptor of the input file (int)
36 @param wfd file descriptor of the output file (int) 36 @param wfd file descriptor of the output file (int)
39 self.readfd = rfd 39 self.readfd = rfd
40 40
41 self.wbuf = '' 41 self.wbuf = ''
42 self.writefd = wfd 42 self.writefd = wfd
43 43
44 def readReady(self,fd): 44 def readReady(self, fd):
45 """ 45 """
46 Public method called when there is data ready to be read. 46 Public method called when there is data ready to be read.
47 47
48 @param fd file descriptor of the file that has data to be read (int) 48 @param fd file descriptor of the file that has data to be read (int)
49 """ 49 """
65 s = self.rbuf[:eol + 1] 65 s = self.rbuf[:eol + 1]
66 self.rbuf = self.rbuf[eol + 1:] 66 self.rbuf = self.rbuf[eol + 1:]
67 self.handleLine(s) 67 self.handleLine(s)
68 eol = self.rbuf.find('\n') 68 eol = self.rbuf.find('\n')
69 69
70 def writeReady(self,fd): 70 def writeReady(self, fd):
71 """ 71 """
72 Public method called when we are ready to write data. 72 Public method called when we are ready to write data.
73 73
74 @param fd file descriptor of the file that has data to be written (int) 74 @param fd file descriptor of the file that has data to be written (int)
75 """ 75 """
76 self.writefd.write(self.wbuf) 76 self.writefd.write(self.wbuf)
77 self.writefd.flush() 77 self.writefd.flush()
78 self.wbuf = '' 78 self.wbuf = ''
79 79
80 def write(self,s): 80 def write(self, s):
81 """ 81 """
82 Public method to write a string. 82 Public method to write a string.
83 83
84 @param s the data to be written (string) 84 @param s the data to be written (string)
85 """ 85 """

eric ide

mercurial