Replace all instances of sockaddr with sockaddr_storage

master
Aadhavan Srinivasan 10 months ago
parent ef869710e5
commit 550643281e

@ -50,7 +50,7 @@ void Sock::sendAll(std::string to_send) {
/* For UDP sockets */ /* For UDP sockets */
if (this->protocol == ES_UDP) { if (this->protocol == ES_UDP) {
sendto(this->sock_fd, to_send.data(), str_length, 0, dest, addrlen); sendto(this->sock_fd, to_send.data(), str_length, 0, (struct sockaddr *)dest, addrlen);
} }
/* For TCP sockets */ /* For TCP sockets */
else { else {
@ -85,7 +85,7 @@ char* Sock::recvAll() {
bool has_been_read = false; bool has_been_read = false;
if (this->protocol == ES_UDP) { if (this->protocol == ES_UDP) {
num_bytes_received = recvfrom(this->sock_fd, buffer, 99, 0, dest, &addrlen); num_bytes_received = recvfrom(this->sock_fd, buffer, 99, 0, (struct sockaddr *)dest, &addrlen);
if (num_bytes_received == 0) { if (num_bytes_received == 0) {
return NULL; return NULL;
} }

Loading…
Cancel
Save