1. Field of the Invention
The present invention relates to packet networks and, more particularly, to a method and apparatus for testing for open ports of an endpoint device in a packet network.
2. Description of the Background Art
Some software applications running on endpoint devices in a packet network require arbitrary hosts in the network to initiate connections. For example, a software application running on a computer in a home may require a host on the Internet to initiate a connection. In a home or small office environment, for example, the software application resides in a device (e.g., computer) connected to the Internet through a local gateway and an internet service provider (ISP). In other environments (e.g., enterprise environments), more elaborate Internet connections are employed using various servers, routers, switches, and the like.
In a packet network, a “port” is an endpoint to a logical connection between devices (e.g., an endpoint device and a host). A port is typically identified by a number. For example, in a transmission control protocol/internet protocol (TCP/IP) network, some ports have numbers that are pre-assigned by the Internet Assigned Numbers Authority (IANA) and are referred to as the “well-known ports.”
In general, some ports of an endpoint device may be blocked by the device or system connecting the endpoint device to the Internet and/or by an ISP. For example, a locate gateway in a home (e.g., a home router) may be configured to block certain ports to prevent unauthorized access to endpoint devices (e.g., port 21 for file transfer protocol (FTP)). If the default port used by a software application is blocked, the software application cannot communicate with its intended host. While the software application may be configured to use alternative ports, a user may not know which ports are open and which are blocked in order to change the configuration of the software application. Accordingly, there exists a need in the art for a method and apparatus for testing for open ports of an endpoint device in a communication network.
Method, apparatus, and computer readable medium for testing for an open port of an endpoint device in a communication network. A test request message is sent from the endpoint device to a server. The test request message is configured to request the server to send a test message to a port of the endpoint device using a protocol. The port is polled for the test message during a time period. The port is indicated as being open if the test message is received by the endpoint device at the port before expiration of the time period. A connect failure message is sent to the server if the test message is not received by the endpoint device at the port before expiration of the time period. The connect failure message may be configured to request the server to send another test message to the endpoint device using the same port and the same or different protocol, or to a different port, using the same or different protocol. The test request message is sent to the server using a predefined port and a predefined protocol. In one embodiment, the test message is sent to the server using port 80 and hypertext transfer protocol (HTTP).
So that the manner in which the above recited features of the present invention can be understood in detail, a more particular description of the invention, briefly summarized above, may be had by reference to embodiments, some of which are illustrated in the appended drawings. It is to be noted, however, that the appended drawings illustrate only typical embodiments of this invention and are therefore not to be considered limiting of its scope, for the invention may admit to other equally effective embodiments.
To facilitate understanding, identical reference numerals have been used, where possible, to designate identical elements that are common to the figures.
In particular, each of the endpoint devices 116 is in communication with the local gateway 110. For example, the endpoint devices 116 may comprise computers. The local gateway 110 provides an interface between the endpoint devices 116 and the access network 108. The local gateway 110 may include a modulator/demodulator (modem) 112 and a router 114. Notably, the local gateway 110 is configured to block certain ports of the endpoint devices 116 for security reasons. The modem 112 is configured to send signals to, and receive signals from, the access network 108 in accordance with the particular protocol of the access network 108. The access network 108 may comprise any type of access facility known in the art, such as a cable facility, a digital subscriber line (DSL) facility, and the like. Accordingly, the modem 112 may be a cable modem, DSL modem, and the like corresponding to the type of access network 108.
The router 114 is configured to route packets between the access network 108 and the endpoint devices 116. The router 114 may also facilitate a local area network (LAN) among the endpoint devices 116. For purposes of clarity by example, the local gateway 110 is shown as having a modem and a router. Those skilled in the art will appreciate that the local gateway 110 may include other types of components in place of or in addition to the router 114, such as hubs, switches, bridges, servers, and the like. In addition, although the modem 112 and the router 114 are shown as part of a single device, it is to be understood that the modem 112 and the router 114 may be separate devices.
The local gateway 110 is configured to communicate with the ISP gateway 106 via the access network 108. The ISP gateway 106 provides an interface between the local gateway 110 and the Internet 104. The ISP gateway 106 may comprise various servers, such as a gateway server, a domain name server (DNS), and the like to facilitate communication between the local gateway 110 and the Internet 104.
Each of the endpoint devices 116 is configured to test for open ports in accordance with one or more aspects of the invention. In one embodiment, each of the endpoint devices 116 executes program code 118 configured to test for open ports. As discussed above, “port” is an endpoint to a logical connection between devices (e.g., an endpoint device 116 and the server 102). In operation, the program code 118 sends a test request message towards the server 102 using a pre-defined port and pre-defined protocol. The pre-defined port and protocol is selected such that the test request message will not be blocked by the local gateway 110 or the ISP 106. In one embodiment, the pre-defined port is the well-known port 80 and the test request message is sent using the hypertext transfer protocol (HTTP). Since port 80 is used by software on the endpoint devices 116 for browsing the worldwide web (WWW), port 80 is typically not blocked by the local gateway 110 and the ISP 106. The test request message may be embedded within an HTTP command. As such, to the local gateway 110 and the ISP gateway 106, it looks like the program code 118 is browsing the web.
The test request message is configured to request the server 102 to send a test message to a selected port using a selected protocol. The selected port may be any of the possible ports (e.g., in TCP/IP, ports range from 0 through 65536). The selected protocol may be any of the various protocols known in the art, such as TCP or user datagram protocol (UDP).
The server 102 first acknowledges the test request message on the pre-defined port using the pre-defined protocol (e.g., port 80 using HTTP) to let the program code 118 know that the test request message was received and the test is about to occur. The server 102 then attempts to send a test message to the program code 118 using the selected port and the selected protocol dictated by the test request message. If the program code 118 receives the test message, the program code 118 acknowledges receipt to the server 102 and indicates that the test is successful (i.e., the selected protocol may be used to communicate via the selected port). If the program code 118 does not receive the test message from the server 102 before expiration of a time period (i.e., a timeout period), the program code 118 sends a connect failure message to the server 102 indicating that the test message was not received using the selected port and the selected protocol. The program code 118 may optionally indicate in the connect failure message to the server 102 to try again on the same port using the same or different protocol, or try again using a different port with the same or different protocol. The server 102 acknowledges the message and proceeds with the test. The process is then repeated.
If, at step 208, an acknowledgement is received from the server during the timeout period, the method 200 proceeds to step 212. At step 212, a determination is made whether a test message is received from the server during the timeout period. That is, the endpoint device polls the selected port for the test message during the timeout period. If a test message is received, the method 200 proceeds to step 214. At step 214, an acknowledgment of receipt of the test message is sent to the server and success of the test is indicated. The selected port may be indicated as being open. The method 200 then ends at step 299.
If, at step 212, the test message is not received from the server during the timeout period, the method 200 proceeds to step 216. At step 216, a message is formed to indicate connect failure. At step 218, a determination is made whether to retry the connection test. If not, the method 200 proceeds to step 220, where the message is sent to the server. The method 200 then ends at step 299.
If, at step 218, the test connection is to be retried, the method 200 proceeds to step 222. At step 222, the message is augmented to indicate that the server is to retry the connection test. Optionally, the message is augmented to include a new port and/or a new protocol to test. The method 200 then returns to step 206 and repeats.
Alternatively, the server may receive a message from the requestor indicating connection failure. If the test is not successful, the method 300 proceeds to step 312. At step 312, a determination is made whether to retry the test. If not, the method 300 ends at step 399. Otherwise, the method 300 proceeds to step 314. For example, the connect failure message received from the requestor may include instructions for retrying the test. The test may be performed using the same port and protocol as the original failed test, or the connect failure message may include instructions to use a new port and/or new protocol in the test. That is, at step 314, the retry message is analyzed to determine if a new port and/or new protocol is to be used. The method 300 then returns to step 306 and repeats.
The memory 403 may store all or portions of one or more programs, program information, and/or data to implement the processes and methods described herein. For example, the memory 403 may store the software application 118 for executing the method 200 of
The computer 400 may be programmed with an operating system, which may be OS/2, Java Virtual Machine, Linux, Solaris, Unix, Windows, Windows95, Windows98, Windows NT, and Windows2000, WindowsME, and WindowsXP, among other known platforms. At least a portion of an operating system may be disposed in the memory 403. The memory 403 may include one or more of the following random access memory, read only memory, magneto-resistive read/write memory, optical read/write memory, cache memory, magnetic read/write memory, and the like, as well as signal-bearing media as described below.
An aspect of the invention is implemented as a program product for use with a computer system. Program(s) of the program product defines functions of embodiments and can be contained on a variety of signal-bearing media, which include, but are not limited to: (i) information permanently stored on non-writable storage media (e.g., read-only memory devices within a computer such as CD-ROM or DVD-ROM disks readable by a CD-ROM drive or a DVD drive); (ii) alterable information stored on writable storage media (e.g., floppy disks within a diskette drive or hard-disk drive or read/writable CD or read/writable DVD); or (iii) information conveyed to a computer by a communications medium, such as through a computer or telephone network, including wireless communications. The latter embodiment specifically includes information downloaded from the Internet and other networks. Such signal-bearing media, when carrying computer-readable instructions that direct functions of the invention, represent embodiments of the invention.
While the foregoing is directed to illustrative embodiments of the present invention, other and further embodiments of the invention may be devised without departing from the basic scope thereof, and the scope thereof is determined by the claims that follow.