Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import socket # used for TCP/IP communication
- import numpy as np
- from PIL import Image
- TCP_IP = '10.42.0.94'
- TCP_PORT = 7
- BUFFER_SIZE = 50
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((TCP_IP, TCP_PORT))
- print("Connected. Test started...")
- im = Image.open('lena224.jpg')
- x = np.array(im, dtype='u1')
- x = 'Desi brate minliiiiii'
- #x = np.ones((224, 224, 3), dtype='u1')
- for i in range(1,30):
- #print ("Iteration " + str(i))
- #s.send(x.tostring())
- s.send(x)
- data = s.recv(BUFFER_SIZE)
- if not data: break
- print "received data:", data
- #co.send(data) # echo
- print("Done!")
- s.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement