Implementing common function of network connection