Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed bug that failed to compile using mingw32 #396

Open
wants to merge 1 commit into
base: v1.5
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions hal/socket/win32/socket_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,26 @@ setSocketNonBlocking(Socket self)
setsockopt(self->fd, IPPROTO_TCP, TCP_NODELAY, (const char*)&tcpNoDelay, sizeof(int));
}


#ifdef __i386__
const char*
inet_ntop(int af, const void* src, char* dst, int cnt){

struct sockaddr_in srcaddr;

memset(&srcaddr, 0, sizeof(struct sockaddr_in));
memcpy(&(srcaddr.sin_addr), src, sizeof(srcaddr.sin_addr));

srcaddr.sin_family = af;
if (WSAAddressToString((struct sockaddr*) &srcaddr, sizeof(struct sockaddr_in), 0, dst, (LPDWORD) &cnt) != 0) {
DWORD rv = WSAGetLastError();
printf("WSAAddressToString() : %d\n",rv);
return NULL;
}
return dst;
}
#endif

static bool
prepareAddress(const char *address, int port, struct sockaddr_in *sockaddr)
{
Expand Down