An optical space communications device includes a transmitter circuit which assigns an idle code indicating that the device is transmitting no data so that the idle code differs from an idle code for another device and which, when the transmitter circuit continuously transmits such idle codes, inserts, between the idle codes, a random code having a different random pattern from a pattern of the idle codes. Thus, light from another device is distinguished from stray light based on the idle codes. A disconnection of the other device is reliably detected. The insertion of random codes reduces effect of crosstalk jitter.