We demonstrate a portable system integrated with time comparison, absolute distance ranging, and optical communication (TRC) to meet the requirements of space gravitational wave detection. A 1 km free-space asynchronous two-way optical link is performed. The TRC realizes optical communication with 7.7×10-5 bit error rate with a Si avalanche photodiode single-photon detector, while the signal intensity is 1.4 photons per pulse with the background noise of 3×104 counts per second. The distance measurement uncertainty is 48.3 mm, and time comparison precision is 162.4 ps. In this TRC system, a vertical-cavity surface-emitting laser diode with a power of 9.1 µW is used, and the equivalent receiving aperture is 0.5 mm. The TRC provides a miniaturization solution for ultra-long distance inter-satellite communication, time comparison, and ranging for space gravitational wave detectors.