Skip to content

Instantly share code, notes, and snippets.

@kanazux
Created May 29, 2018 18:52
Show Gist options
  • Save kanazux/e58678a135d7fac95d65bf4c65f69b1e to your computer and use it in GitHub Desktop.
Save kanazux/e58678a135d7fac95d65bf4c65f69b1e to your computer and use it in GitHub Desktop.
import socket
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(('127.0.0.1', 36547))
server.listen(10)
sock, addr = server.accept()
sock.recv(1024)
b'teste'
pegar_tamanho_f = int(sock.recv(1024).decode())
print(pegar_tamanho_f)
1212149
with open('novo_classifier.tgz', 'wb') as nc: nc.write(sock.recv(pegar_tamanho_f))
from subprocess import check_output
print(check_output(['md5sum /home/kanazuchi/projetos/sockets/*.tgz'], shell=True))
b'b0c3ddce35fa5cc90ec5943a590005b6  /home/kanazuchi/projetos/sockets/classifiers250418.tgz\nb0c3ddce35fa5cc90ec5943a590005b6  /home/kanazuchi/projetos/sockets/nn.tgz\nb0c3ddce35fa5cc90ec5943a590005b6  /home/kanazuchi/projetos/sockets/novo_classifier.tgz\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment