Seeing as you have not been taught anything about sockets this seems a little much for a first year computer project. If I were to do this I would try using
libpcap. It lets you capture all the packets that sent or received over the computers network interfaces. This is what
wireshark uses.