We study joint network-coding and channel-coding design to optimize delay performance. In our systems, network codes (network layer) are on top of channel codes (physical layer). Network codes run in a rateless random method, i.e., source and intermediate nodes randomly produce and transmit codewords until transmission succeeds. Thus, the rateless network codes have block-erasure-correction capability. The physical layer codewords are disturbed by channel noise. For the constraint of finite transmission time (finite block length), transmission errors are inevitable in the physical layer. We show that the physical-layer erasure probability is affected by both layers. Then, there is an interaction between network codes and channel codes, concerning the delay measure of the networks. We model the delay of each generation as the independent, identically distributed random variables. We show tradeoffs between the network layer and the physical layer on the length of network codewords, and on the transmission time of physical-layer codewords. To measure delay performance, we use expected delay and network-layer decoding error probability of a given delay, which are measures for networks without and with strict maximum-delay constraints, respectively. We show how to evaluate these measures for the coded networks with erasure channels. Then, we formulate problems to optimize the delay performance, and solutions are suggested.