MCPcopy Create free account
hub / github.com/secdev/scapy / send

Method send

scapy/layers/tuntap.py:265–286  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

263 return r
264
265 def send(self, x):
266 # type: (Packet) -> int
267 if hasattr(x, "sent_time"):
268 x.sent_time = time.time()
269
270 if self.kernel_packet_class == IPv46:
271 # IPv46 is an auto-detection wrapper; we should just push through
272 # packets normally if we got IP or IPv6.
273 if not isinstance(x, (IP, IPv6)):
274 x = IP() / x
275 elif not isinstance(x, self.kernel_packet_class):
276 x = self.kernel_packet_class() / x
277
278 sx = raw(x)
279
280 try:
281 r = self.outs.write(sx)
282 self.outs.flush()
283 return r
284 except socket.error:
285 log_runtime.error("%s send",
286 self.__class__.__name__, exc_info=True)
287
288
289# Bindings #

Callers

nothing calls this directly

Calls 4

IPClass · 0.90
rawFunction · 0.90
writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected