コード例 #1
0
    def send_img(self, filepath):
        f = open(filepath, "rb")  # open that file for reading binary
        filename = os.path.basename(filepath)
        self.print(f"Sending filename {filename} to server")
        self.sock.sendto(filename.encode('utf-8'), self.udp_info) # send file name to server

        self.print('Sending file contents to server')
        rdt_sender.rdt_send(f, self.udp_info, self.sock)
        f.close()
コード例 #2
0
 def send_img(self, client):
     try:
         f = open(self.response_filepath,
                  'rb')  # open file for reading binary
     except FileNotFoundError:
         self.print(
             f'Response file {self.response_filepath} does not exist')
         return
     self.print("Sending file response")
     rdt_sender.rdt_send(f, client, self.sock)  # RDT send
     f.close()
コード例 #3
0
 def send_img(self, client):
     try:
         f = open(self.response_filepath, 'rb') # open file for reading binary
     except FileNotFoundError:
         self.print(f'Response file {self.response_filepath} does not exist')
         return
     filename = os.path.basename(self.response_filepath)	# path to file
     self.print("Sending filename of response")
     self.sock.sendto(filename.encode('utf-8'), client) # send filename to client
     self.print("Sending file response")
     rdt_sender.rdt_send(f, client, self.sock) # RDT send
     f.close()
コード例 #4
0
 def send_img(self, filepath):
     f = open(filepath, "rb")  # open that file for reading binary
     self.print('Sending file contents to server')
     rdt_sender.rdt_send(f, self.udp_info, self.sock)
     f.close()