Internal function used by send and sendp
(x, # type: _PacketIterable
_func, # type: Callable[[NetworkInterface], Type[SuperSocket]]
inter=0, # type: int
loop=0, # type: int
iface=None, # type: Optional[_GlobInterfaceType]
count=None, # type: Optional[int]
verbose=None, # type: Optional[int]
realtime=False, # type: bool
return_packets=False, # type: bool
socket=None, # type: Optional[SuperSocket]
**kargs # type: Any
)
| 434 | |
| 435 | |
| 436 | def _send(x, # type: _PacketIterable |
| 437 | _func, # type: Callable[[NetworkInterface], Type[SuperSocket]] |
| 438 | inter=0, # type: int |
| 439 | loop=0, # type: int |
| 440 | iface=None, # type: Optional[_GlobInterfaceType] |
| 441 | count=None, # type: Optional[int] |
| 442 | verbose=None, # type: Optional[int] |
| 443 | realtime=False, # type: bool |
| 444 | return_packets=False, # type: bool |
| 445 | socket=None, # type: Optional[SuperSocket] |
| 446 | **kargs # type: Any |
| 447 | ): |
| 448 | # type: (...) -> Optional[PacketList] |
| 449 | """Internal function used by send and sendp""" |
| 450 | need_closing = socket is None |
| 451 | iface = resolve_iface(iface or conf.iface) |
| 452 | socket = socket or _func(iface)(iface=iface, **kargs) |
| 453 | results = __gen_send(socket, x, inter=inter, loop=loop, |
| 454 | count=count, verbose=verbose, |
| 455 | realtime=realtime, return_packets=return_packets) |
| 456 | if need_closing: |
| 457 | socket.close() |
| 458 | return results |
| 459 | |
| 460 | |
| 461 | @conf.commands.register |
no test coverage detected