def main(): showDeviceInfo() p = Ping('0.0.0.0', '0.0.0.0') currentSocket = p.get_socket() buffer = [] print(uploadedFiles) while (True): updateBattery() inputs, output, exception = select.select([currentSocket, sys.stdin], [currentSocket], []) for i in inputs: if i == currentSocket: receiverFunction(p) elif i == sys.stdin: x = raw_input() buffer.append(x) if currentSocket in output: for i in range(len(buffer)): if buffer[i] == "u": senderFunction(p, 'help.txt') elif buffer[i] == "help": downloadFunction(p, 'help.txt') elif buffer[i] == "showInfo": showDeviceInfo() elif buffer[i] == "showUfiles": showUploadedFiles() elif buffer[i] == "showDfiles": showDownloadedFiles() else: print("Commmand not found! try again.") buffer = []
def main(): p = Ping('0.0.0.0', '0.0.0.0') currentSocket = p.get_socket() buffer = [] while(True): inputs, output, exception = select.select([currentSocket, sys.stdin] , [currentSocket], []) for i in inputs: if i == currentSocket : receiverFunction(p) elif i == sys.stdin : x = raw_input() buffer.append(x) if currentSocket in output : for i in range(len(buffer)): if buffer[i] == "upload": senderFunction(p) elif buffer[i] == "download": downloadFunction(p) elif buffer[i] == "vim": showFile() else : print "Commmand not found! try again." buffer = []