2016-07-28 15:22:59 -04:00
|
|
|
import socket
|
|
|
|
import pygame
|
|
|
|
import sys
|
|
|
|
|
|
|
|
host = "192.168.1.136"
|
2016-07-28 15:27:33 -04:00
|
|
|
port = 5802
|
2016-07-28 15:22:59 -04:00
|
|
|
screen = pygame.display.set_mode((640,480),0)
|
|
|
|
|
|
|
|
|
|
|
|
while True:
|
|
|
|
clientsocket=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
clientsocket.connect((host, port))
|
|
|
|
received = []
|
|
|
|
while True:
|
|
|
|
recvd_data = clientsocket.recv(230400)
|
|
|
|
if not recvd_data:
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
received.append(recvd_data)
|
|
|
|
|
|
|
|
dataset = ''.join(received)
|
|
|
|
print(len(dataset))
|
2016-07-28 15:27:33 -04:00
|
|
|
image = pygame.image.fromstring(dataset,(640,480),"RGB")
|
|
|
|
screen.blit(image,(0,0))
|
2016-07-28 15:22:59 -04:00
|
|
|
pygame.display.update()
|
|
|
|
|
|
|
|
for event in pygame.event.get():
|
|
|
|
if event.type == pygame.QUIT:
|
|
|
|
pygame.quit()
|
2016-07-28 15:27:33 -04:00
|
|
|
sys.exit()
|