-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsendip.py
More file actions
84 lines (55 loc) · 2.07 KB
/
sendip.py
File metadata and controls
84 lines (55 loc) · 2.07 KB
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
75
76
77
78
79
80
81
82
83
84
import socket
# Specify the IP address and port of the device you want to send a message to
device_ip = '192.168.88.74'
port = 3306
# Create a TCP socket
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
# Connect to the device
client_socket.connect((device_ip, port))
# Send the message
message = 'Hello from your home boy!'
client_socket.sendall(message.encode())
# Close the socket
client_socket.close()
print("Message successfully sent to device with IP address " + device_ip)
except OSError as e:
print("An error occurred while sending the message:", str(e))
# import socket
# # Specify the IP address and port of the device you want to send a message to
# device_ip = '192.168.88.102'
# port = 8080
# # Create a TCP socket
# client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# try:
# # Connect to the device
# client_socket.connect((device_ip, port))
# # Send the message
# message = 'Hello from your home boy!'
# client_socket.sendall(message.encode())
# # Close the socket
# client_socket.close()
# print("Message successfully sent to device with IP address " + device_ip)
# except OSError as e:
# print("An error occurred while sending the message:", str(e))
# version 1
# import socket
# # Specify the IP address and port of the device you want to send a message to
# device_ip = '192.168.88.102'
# port = 443
# # Create a TCP socket
# client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# try:
# # Connect to the device
# client_socket.connect((device_ip, port))
# # Send the ADB command to get device data
# adb_command = 'adb shell getprop\n'
# client_socket.sendall(adb_command.encode())
# # Receive the response from the device
# response = client_socket.recv(4096).decode()
# # Close the socket
# client_socket.close()
# print("Device data received from the device with IP address " + device_ip)
# print(response)
# except OSError as e:
# print("An error occurred while fetching device data:", str(e))