Sender IP/Port for UDP Socket
Is it possible to obtain the sender IP and (dynamically obtained) port with C sockets? I have the following:

    memset(&hints, 0, sizeof hints); 
    hints.ai_family     = AF_UNSPEC; 
    hints.ai_socktype   = SOCK_DGRAM;
    
    if ((rv = getaddrinfo(NULL, DATABASEPORT, &hints, &servinfo)) != 0) { 
        fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv)); 
        exit(1);
    }
    
    for(p = servinfo; p != NULL; p = p->ai_next) {
        if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
            perror("socket"); 
            continue;
        }
        
        break;
    }

Which is pretty much taken from a guide (though I kind of get it?). But I'm having trouble identifying which information I would use to find out the client data. 

Any and all help is appreciated, thanks!
Sender IP/Port for UDP Socket
===

Is it possible to obtain the sender IP and (dynamically obtained) port with C sockets? I have the following:

    memset(&hints, 0, sizeof hints); 
    hints.ai_family     = AF_UNSPEC; 
    hints.ai_socktype   = SOCK_DGRAM;
    
    if ((rv = getaddrinfo(NULL, DATABASEPORT, &hints, &servinfo)) != 0) { 
        fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv)); 
        exit(1);
    }
    
    for(p = servinfo; p != NULL; p = p->ai_next) {
        if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
            perror("socket"); 
            continue;
        }
        
        break;
    }

Which is pretty much taken from a guide (though I kind of get it?). But I'm having trouble identifying which information I would use to find out the client data. 

Any and all help is appreciated, thanks!