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

Method recv

scapy/supersocket.py:198–220  ·  view source on GitHub ↗

Receive a Packet according to the `basecls` of this socket :param x: Maximum number of bytes to be received, defaults to MTU :return: The received `Packet` object, or None

(self, x=MTU, **kwargs)

Source from the content-addressed store, hash-verified

196 return conf.raw_layer, self.ins.recv(x), None
197
198 def recv(self, x=MTU, **kwargs):
199 # type: (int, **Any) -> Optional[Packet]
200 """Receive a Packet according to the `basecls` of this socket
201
202 :param x: Maximum number of bytes to be received, defaults to MTU
203 :return: The received `Packet` object, or None
204 """
205 cls, val, ts = self.recv_raw(x)
206 if not val or not cls:
207 return None
208 try:
209 pkt = cls(val, **kwargs) # type: Packet
210 except KeyboardInterrupt:
211 raise
212 except Exception:
213 if conf.debug_dissector:
214 from scapy.sendrecv import debug
215 debug.crashed_on = (cls, val)
216 raise
217 pkt = conf.raw_layer(val)
218 if ts:
219 pkt.time = ts
220 return pkt
221
222 def fileno(self):
223 # type: () -> int

Callers

nothing calls this directly

Calls 1

recv_rawMethod · 0.95

Tested by

no test coverage detected