I'm working on python GUI-application with Tkinter to exchange files between two local PC Local Client and Local Server using the socket library (Local file transfer). What I want to do is to browse remotely the Server folders from the Client GUI to choose a file then send it to the Client computer.
Right now, I'm running the Client and the Server on the same machine.
The appliccation works as follows:
-After I run the Server script ,it waits for an incoming connection.
-I run the Client script (GUI) on the same machine, then I browse folders using this function :
def browser(self):
options = {
"mustexist": False,
"initialdir": '/media', #default path
"title": 'Choose a directory'
}
#this will open a dialogue window to select the desired directory
self.browsePath = tkFileDialog.askdirectory(**options)
self.path_Etr.delete(0,END)
self.path_Etr.insert(0,self.browePath)
-The Client send the chosen file path (text) to the Server
-The Server send back the file
That process works fine one the same machine (because the Client and the Server had same directory-tree) .
But how to do that on separate machines , I wonder if there's a way to receive the Server directory-tree and vizualize it on Client GUI or somthing else?
I hope my question is claire !
You would need to create a server on the remote computer, such that when it is sent a directory over
sockets, it will send back the contents. On the other computer, you would need a client. If there is no predetermined server/client, have all computers be servers, until told otherwise.