I am trying to send/receive some data across 2 computers (mac, ubuntu) using a UDP connection and they are connected with an ethernet cable. When I run the server to receive some data from a client, I get the data but if I send it back, the client does not receive it. On further investigation, I found out that the clientAddress that I store upon recvfrom() does not have information relating to the ipaddress and port of the client (it is all zeroes). Any clues on what might be going wrong ?
n = recvfrom(sockfd, msg, 1000, 0, (sockaddr *)&clientAddress, &len);
sendto(sockfd, msg, n, 0, (sockaddr *)&clientAddress, sizeof(clientAddress));