mirror of https://github.com/ARMmbed/mbed-os.git
In response to: IOTSFW-325
1. Removed globaly initialized data inside class test() function 2. Removed global variables initialization dependency. Any cause some Python implementations and configurations to fail in runtime 3. Added info about Echo port #7 rationale. 4. Testsed with K64F and network tests: Test summary: +--------+--------+---------+----------------------------+--------------------+ | Result | Target | Test ID | Test Description | Elapsed Time (sec) | +--------+--------+---------+----------------------------+--------------------+ | OK | K64F | NET_1 | TCP client hello world | 3.26 | | OK | K64F | NET_13 | TCP client echo loop | 2.05 | | OK | K64F | NET_2 | NIST Internet Time Service | 3.43 | | OK | K64F | NET_3 | TCP echo server | 1.54 | | OK | K64F | NET_4 | TCP echo client | 1.54 | | OK | K64F | NET_5 | UDP echo server | 1.46 | | OK | K64F | NET_6 | UDP echo client | 1.6 | | OK | K64F | NET_7 | HTTP client hello world | 3.4 | | OK | K64F | NET_8 | NTP client | 2.39 | +--------+--------+---------+----------------------------+--------------------+ Result: 9 OK Completed in 122.18 secpull/922/head
parent
4d5b8776d4
commit
78cc959f50
|
@ -20,9 +20,6 @@ import socket
|
|||
from sys import stdout
|
||||
from SocketServer import BaseRequestHandler, TCPServer
|
||||
|
||||
SERVER_IP = str(socket.gethostbyname(socket.getfqdn()))
|
||||
SERVER_PORT = 7
|
||||
|
||||
class TCPEchoClient_Handler(BaseRequestHandler):
|
||||
def handle(self):
|
||||
""" One handle per connection
|
||||
|
@ -67,6 +64,22 @@ class TCPEchoClientTest():
|
|||
selftest.notify(c.strip())
|
||||
|
||||
def test(self, selftest):
|
||||
# We need to discover SERVEP_IP and set up SERVER_PORT
|
||||
# Note: Port 7 is Echo Protocol:
|
||||
#
|
||||
# Port number rationale:
|
||||
#
|
||||
# The Echo Protocol is a service in the Internet Protocol Suite defined
|
||||
# in RFC 862. It was originally proposed for testing and measurement
|
||||
# of round-trip times[citation needed] in IP networks.
|
||||
#
|
||||
# A host may connect to a server that supports the Echo Protocol using
|
||||
# the Transmission Control Protocol (TCP) or the User Datagram Protocol
|
||||
# (UDP) on the well-known port number 7. The server sends back an
|
||||
# identical copy of the data it received.
|
||||
SERVER_IP = str(socket.gethostbyname(socket.getfqdn()))
|
||||
SERVER_PORT = 7
|
||||
|
||||
# Returning none will suppress host test from printing success code
|
||||
server = TCPServer((SERVER_IP, SERVER_PORT), TCPEchoClient_Handler)
|
||||
print "HOST: Listening for TCP connections: " + SERVER_IP + ":" + str(SERVER_PORT)
|
||||
|
|
|
@ -20,9 +20,6 @@ import socket
|
|||
from sys import stdout
|
||||
from SocketServer import BaseRequestHandler, UDPServer
|
||||
|
||||
SERVER_IP = str(socket.gethostbyname(socket.getfqdn()))
|
||||
SERVER_PORT = 7
|
||||
|
||||
class UDPEchoClient_Handler(BaseRequestHandler):
|
||||
def handle(self):
|
||||
""" One handle per connection
|
||||
|
@ -57,6 +54,22 @@ class UDPEchoClientTest():
|
|||
return selftest.RESULT_PASSIVE
|
||||
|
||||
def test(self, selftest):
|
||||
# We need to discover SERVEP_IP and set up SERVER_PORT
|
||||
# Note: Port 7 is Echo Protocol:
|
||||
#
|
||||
# Port number rationale:
|
||||
#
|
||||
# The Echo Protocol is a service in the Internet Protocol Suite defined
|
||||
# in RFC 862. It was originally proposed for testing and measurement
|
||||
# of round-trip times[citation needed] in IP networks.
|
||||
#
|
||||
# A host may connect to a server that supports the Echo Protocol using
|
||||
# the Transmission Control Protocol (TCP) or the User Datagram Protocol
|
||||
# (UDP) on the well-known port number 7. The server sends back an
|
||||
# identical copy of the data it received.
|
||||
SERVER_IP = str(socket.gethostbyname(socket.getfqdn()))
|
||||
SERVER_PORT = 7
|
||||
|
||||
# Returning none will suppress host test from printing success code
|
||||
server = UDPServer((SERVER_IP, SERVER_PORT), UDPEchoClient_Handler)
|
||||
print "HOST: Listening for UDP connections..."
|
||||
|
|
Loading…
Reference in New Issue