Skip to content

Commit 57ff28a

Browse files
Singh Vijendra (BEG/EOR2)Singh Vijendra (BEG/EOR2)
authored andcommitted
removed the code not required for image transfer
1 parent 74ed6a6 commit 57ff28a

File tree

2 files changed

+1
-33
lines changed

2 files changed

+1
-33
lines changed

cam_streaming/client.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@ def receive_data(conn):
4545
return (data_id, payload)
4646

4747

48-
# define category in which you would like to define data
49-
data_identifiers = {"info": 0, "data": 1, "image": 2}
50-
# key to be trusted by server
51-
key_message = "C0nn3c+10n"
52-
# a sample dictionary data
53-
data = {"data number": 0, "message": "A new message has been arrived from client"}
54-
55-
5648
def main(config):
5749
# create client socket object and connect it to server
5850
conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -70,10 +62,6 @@ def main(config):
7062
sys.exit()
7163
while True:
7264
try:
73-
# send dict
74-
data["data number"] += 1
75-
send_data(conn, data, config["data_identifiers"]["data"])
76-
print(receive_data(conn)[1])
7765
# send image
7866
ret, frame = cap.read()
7967
if not ret:
@@ -88,7 +76,7 @@ def main(config):
8876
if config["client"]["grayscale"]:
8977
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
9078
send_data(conn, frame, config["data_identifiers"]["image"])
91-
print(receive_data(conn)[1])
79+
# print(receive_data(conn)[1])
9280
except KeyboardInterrupt:
9381
print("\n[INFO]: Keyboard Interrupt received")
9482
# once keyboard interrupt is received, send signal to server for closing connection

cam_streaming/server.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,6 @@ def receive_data(conn):
4747
return (data_id, payload)
4848

4949

50-
def do_something(conn_name, data):
51-
"""
52-
@beief: a sample function to do something with received data
53-
@args[in]:
54-
conn_name: connection name from where dat is received
55-
data: received data
56-
@args[out]:
57-
a string response
58-
"""
59-
print(
60-
"Data number {} received from client {}".format(data["data number"], conn_name)
61-
)
62-
time.sleep(0.1)
63-
return "Data number {} received on server".format(data["data number"])
64-
65-
6650
def handle_client(conn, conn_name, config):
6751
"""
6852
@brief: handle the connection from client at seperate thread
@@ -92,10 +76,6 @@ def handle_client(conn, conn_name, config):
9276
timer = current_time
9377
# send response to client
9478
send_data(conn, "Image received on server")
95-
elif data_id == config["data_identifiers"]["data"]:
96-
# otherwise send the data to do something
97-
response = do_something(conn_name, payload)
98-
send_data(conn, response)
9979
else:
10080
# if data is 'bye' then break the loop and client connection will be closed
10181
if payload == "bye":

0 commit comments

Comments
 (0)