If the judge grants a restraining order, it takes effect straight away and from that point the harasser must obey the conditions of the order.
However, the harasser can’t be charged and prosecuted for any breach of the order until they’ve been “served” with the order (that is, given it personally). This will be done by either a court bailiff, a private process server or the police hand-delivering a copy of the order to them.
A copy of the order will also be given to you and to the local police station.