SHARE
TWEET

Untitled

a guest Mar 20th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from socket import *
  2. import os
  3.  
  4. #os.system('clear')
  5.  
  6. IP_ADDR = 'localhost'
  7. PORT = 9090
  8.  
  9. def sendBlock(nameoffile):
  10.     sock = socket(AF_INET, SOCK_DGRAM)
  11.     f = open(nameoffile,'rb')
  12.  
  13.     while True:
  14.         data = f.readline()
  15.        
  16.         if (data == b''):
  17.             sock.sendto(b'~EOF~',(IP_ADDR, PORT))
  18.             break
  19.  
  20.         sock.sendto(data, (IP_ADDR, PORT))
  21.    
  22.  
  23. sendBlock('test.q')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top