Esempio n. 1
0
 def send(self, data):
     if not self.socket:
         raise ConnectFirst()
     try:
         _send(self.socket, data, socket_type="tcp")
     except socket.error as e:
         if "reset by peer" in e.message:
             raise NoClient()
         raise
     return self
Esempio n. 2
0
 def send(self, data):
     if not self.client:
         raise NoClient()
     _send(self.client, data, socket_type="tcp")
     return self
Esempio n. 3
0
 def send(self, data):
     if not self.socket:
         raise ConnectFirst()
     _send(self.socket, data, socket_type="tcp")
     return self
Esempio n. 4
0
 def send(self, data, ip, port):
     s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
     if ip == broadcast_address:
         s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
     _send(s, data, "udp", ip, port)