Add missing socket import and typecast for Graphite port