Some useful template for C / Java net operations