def __init__(self, node, dst_ip, proto = 'udp', iface = None, label = '', dst_port=40, interval = 0.5, data_size =10): Application.__init__(self, node, label) self.addr = (dst_ip,dst_port) if proto == 'udp': self.proto = socket.SOCK_DGRAM elif proto == 'tcp': self.proto = socket.SOCK_STREAM else: raise RuntimeError('only TCP and udp are supported, not :' + str(proto)) self.s = socket.socket(self, socket.AF_INET6, self.proto)
def __init__(self, node, label ='', ip_version = 6, proto = 'udp', port=40): Application.__init__(self, node, label) self.buf = 1024 self.addr = ('',port) if proto == 'udp': self.proto = socket.SOCK_DGRAM elif proto == 'tcp': self.proto = socket.SOCK_STREAM else: raise RuntimeError('only TCP and udp are supported, not :' + str(proto)) if ip_version == 6: family = socket.AF_INET6 else: family = socket.AF_INET self.s = socket.socket(self, family, self.proto)#create socket