Use Socket.create_socket_source() as it works for both TCP and UDP sockets, but also does not use GDatagramBased interface, thus should allow building on systems with older GLib versions.