The invention discloses a terminal equipment real-time connecting and disconnecting sensing method based on SDN. When a host computer is connected into the SDN, a broadcast packet is sent to a switch, the switch receives the broadcast packet and transmits the broadcast packet to a controller in the mode of packet-in events, the controller temporarily records position information of a source host computer after receiving the broadcast packet and initializes two host computer information tables, respectively, {IP: MAC, (DPID, PORT)}, and {(DPID, PORT): IP}; then, after the controller captures a DHCPACK information packet, the controller extracts IP address information and MAC address information in the DHCPACK information packet, combines the position information recorded temporarily in advance and records the host computer information onto the two main computer information tables; when the host computer is disconnected, the event of Port Status is triggered, the controller initially sends detection information to the position where the host computer is located, if the detection information is not responded within the required time, then the host computer is disconnected from the network, and corresponding items in the tables are deleted by the controller. The terminal equipment real-time connecting and disconnecting sensing method based on the SDN can sense disconnection of the host machine in real time, improves subsequent checking and use efficiency, and meanwhile overcomes the defect that host computer information tables need to be updated frequently in an existing controller.