-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
74 lines (32 loc) · 1000 Bytes
/
Copy pathserver.py
File metadata and controls
74 lines (32 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import socket
import capture
import time
server = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
machine =socket.gethostbyname(socket.gethostname())
port=2328
print(machine,port)
server.bind(('192.168.0.105',port))
server.listen()
def sender():
print(f"[{machine}] waiting for the connection from the client ")
while True:
client,address=server.accept()
print(" Client connected and sending file now")
print("Capturing Image")
capture.capt()
print("image captured")
file= open("178.jpg",'rb')
print("image saved")
data=file.read(40960000)
print("Reread image and Sending it to client ")
while True:
if data:
client.send(data)
data=file.read(40960000)
print("Image sent Sucessfully")
break
else:
print("failed to send data")
break
sender()
# for pi