I am capturing screenshots from the server, then sending it to the client, but the images get all sent as one big file to the client that keeps expanding in size. This only happens when i send from one machine to another (I am working on a local netwrok) but when running both client and server from my machine they work fine. Note: for the client on the other machine, I packaged it into an exe using pyinstaller, since this machine does not have python.
server code:
host="192.168.43.79" # Set the server address to variable host
port=4446 # Sets the variable port to 4446
import time
import pyautogui
from socket import *
import os
s=socket(AF_INET, SOCK_STREAM)s.bind((host,port)) print("Listening for connections.. ")q,addr=s.accept()i = 0
while True:screenshot = pyautogui.screenshot()screenshot.save(str(i) + ".jpg")with open(str(i) + ".jpg", "rb") as f:data = f.read(4096)while data:q.send(data)data = f.read(4096)q.send(b"full")i += 1time.sleep(0.3)
client code:
host="192.168.43.79" # Set the server address to variable hostport=4446 # Sets the variable port to 4446from multiprocessing.reduction import recv_handle
from socket import * # Imports socket modules=socket(AF_INET, SOCK_STREAM) # Creates a socket
s.connect((host,port)) i = 0
while True:with open(str(i) + "s.jpg", "wb") as f:recv_data = s.recv(4096) while recv_data:f.write(recv_data)recv_data = s.recv(4096)if(recv_data == b"full"):breaki += 1