MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / echo

Method echo

pager_lib/smb/SMBConnection.py:561–589  ·  view source on GitHub ↗

Send an echo command containing *data* to the remote SMB/CIFS server. The remote SMB/CIFS will reply with the same *data*. :param bytes data: Data to send to the remote server. Must be a bytes object. :return: The *data* parameter

(self, data, timeout = 10)

Source from the content-addressed store, hash-verified

559 self.is_busy = False
560
561 def echo(self, data, timeout = 10):
562 """
563 Send an echo command containing *data* to the remote SMB/CIFS server. The remote SMB/CIFS will reply with the same *data*.
564
565 :param bytes data: Data to send to the remote server. Must be a bytes object.
566 :return: The *data* parameter
567 """
568 if not self.sock:
569 raise NotConnectedError('Not connected to server')
570
571 results = [ ]
572
573 def cb(r):
574 self.is_busy = False
575 results.append(r)
576
577 def eb(failure):
578 self.is_busy = False
579 raise failure
580
581 self.is_busy = True
582 try:
583 self._echo(data, cb, eb)
584 while self.is_busy:
585 self._pollForNetBIOSPacket(timeout)
586 finally:
587 self.is_busy = False
588
589 return results[0]
590
591 #
592 # Protected Methods

Callers

nothing calls this directly

Calls 2

_pollForNetBIOSPacketMethod · 0.95
NotConnectedErrorClass · 0.70

Tested by

no test coverage detected