Fix compile error on Linux (clang and gcc)

This commit is contained in:
Kirigaya Kazuto 2018-05-04 07:15:30 +08:00
parent 8290d01644
commit 0ed154eeff

View File

@ -425,7 +425,7 @@ int udpsock::sendto(const std::string& IPStr, int Port, const void* buffer, int
int udpsock::recvfrom(std::string& fromIP, void* buffer, int bufferLength) int udpsock::recvfrom(std::string& fromIP, void* buffer, int bufferLength)
{ {
sockaddr_in saddr; sockaddr_in saddr;
int saddrlen = sizeof(saddr); socklen_t saddrlen = sizeof(saddr);
int ret = ::recvfrom(_pp->sfd, (char*)buffer, bufferLength, 0, (sockaddr*)&saddr, &saddrlen); int ret = ::recvfrom(_pp->sfd, (char*)buffer, bufferLength, 0, (sockaddr*)&saddr, &saddrlen);
if (ret < 0) if (ret < 0)