Lines Matching refs:self
7 def __init__(self, host_cfg, portnum): argument
9 self.host_cfg = host_cfg
10 self.portnum = portnum
11 self.pkt_size = 8192
12 self.socket = None
13 self.isblocking = True
14 logging.debug("created %s" % str(self))
16 def connect(self): argument
17 self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
18 self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
19 self.socket.bind((self.host_cfg, self.portnum))
20 ….debug("Initializing network interface for communication host: %s:%d", self.host_cfg, self.portnum)
21 self.socket.listen(5)
24 ra,wa,ea = select.select([self.socket], [], [], 30)
29 self.connection, addr = self.socket.accept()
35 def read(self): argument
36 if self.isblocking:
39 self.connection.settimeout(15)
40 self.isblocking = False
43 r_bytes = self.connection.recv(self.pkt_size)
50 def write(self, str): argument
51 if not self.isblocking:
52 self.connection.setblocking(1)
53 self.isblocking = True
54 return self.connection.send(str.encode())
56 def close(self): argument
57 if self.connection:
59 self.connection.close()
60 return self.socket
62 def __str__(self): argument
63 return "interface: %s %d" % (self.host_cfg, self.portnum)