We introduce a novel network-coding scheme that can be implemented in all-optical multicast networks. A simple and successful module based on the all-optical XOR gate is designed to realize the network coding scheme. The module is a key hardware component in realizing the proposed scheme. The working principle and the experimental results of the module are also presented. Experimental results show that the function of the module is sufficient in satisfying the requirements of the proposed network coding scheme.