Why using heap allocation for tcpSocket?