Responses by males to the level of sperm competition have been documented across a wide range of taxa. Recent work in Drosophila melanogaster shows that males respond adaptively to the presence of other males by making facultative adjustments to mating duration, resulting in increased transfer of ejaculate proteins, direct effects on postmating responses in females, and, ultimately, increased male competitive reproductive success. Here, we investigated how males detect the presence of rival males. We tested the effect of the length of male-to-male exposure, male age at first exposure, time since initial exposure to rivals and density. We found that the longer the males were exposed to rivals prior to mating (from 0 to 101 h of exposure), the longer their subsequent mating duration. There was no detectable effect, however, of increasing the number of rivals above 1. Increasing the density (hence encounter rate) in which males were kept had no effect on a male's response to rivals and there was also no evidence that responses to rivals could be evoked by a brief (2 h) time window of exposure to males at various times prior to mating. The age at which males were first exposed to other males did not affect their ability to respond to rivals. Taken together, our findings show that it is the absolute length of exposure to rivals and not the number of rivals that is critical in determining male plastic responses to the potential level of sperm competition in D. melanogaster.