Fix socket-api byte order issue when host/network order are the same (#1327)
Fix socket-api byte order issue for systems where host byte order and network byte order are the same: - Document data structures used for storing IP addresses - Fix bug in bind and connect methods by updating code in wasi_socket_ext
This commit is contained in:
@ -60,9 +60,7 @@ os_socket_bind(bh_socket_t socket, const char *host, int *port)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
addr.sin_addr.s_addr = inet_addr(host);
|
||||
addr.sin_port = htons(*port);
|
||||
addr.sin_family = AF_INET;
|
||||
textual_addr_to_sockaddr(host, *port, &addr);
|
||||
|
||||
ret = bind(socket, (struct sockaddr *)&addr, sizeof(addr));
|
||||
if (ret < 0) {
|
||||
|
||||
Reference in New Issue
Block a user