mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
add DNS test for socket
This commit is contained in:
parent
82f0f3dc42
commit
3a39ff5944
12
examples/socket/socket_DNS.py
Normal file
12
examples/socket/socket_DNS.py
Normal file
@ -0,0 +1,12 @@
|
||||
import socket
|
||||
|
||||
# 创建一个 socket 对象
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
|
||||
# 使用域名和端口来进行连接
|
||||
s.connect(("dns.google", 53))
|
||||
|
||||
# 关闭连接
|
||||
s.close()
|
||||
|
||||
print("PASS")
|
@ -291,7 +291,8 @@ TEST(socket, json_issue) {
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_RUN_SINGLE_FILE(socket, socket_GET, "test/python/socket/socket_GET.py")
|
||||
TEST_RUN_SINGLE_FILE_PASS(socket, socket_GET, "test/python/socket/socket_GET.py")
|
||||
TEST_RUN_SINGLE_FILE_PASS(socket, socket_DNS, "test/python/socket/socket_DNS.py")
|
||||
|
||||
#endif
|
||||
|
||||
|
12
port/linux/test/python/socket/socket_DNS.py
Normal file
12
port/linux/test/python/socket/socket_DNS.py
Normal file
@ -0,0 +1,12 @@
|
||||
import socket
|
||||
|
||||
# 创建一个 socket 对象
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
|
||||
# 使用域名和端口来进行连接
|
||||
s.connect(("dns.google", 53))
|
||||
|
||||
# 关闭连接
|
||||
s.close()
|
||||
|
||||
print("PASS")
|
Loading…
x
Reference in New Issue
Block a user