emscripten-core / emscripten-core/emscripten
Unable to connect to a WebSocket server using the posix socket api in a web worker thread.
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
/* fill address struct */
struct sockaddr_in address; /* Internet socket address stuct */
address.sin_addr.s_addr = TCPHOST;
address.sin_port = htons(nHostPort);
address.sin_family = AF_INET;
memset(&(address.sin_zero), 0, 8);
// Don't hang around after closing
linger ling;
ling.l_onoff = 1;
ling.l_linger = 0;
setsockopt(_hSocket, 1, SO_LINGER, (char*)&ling, sizeof(ling));
//bind the socket to the port (and localhost)
auto res = connect(_hSocket, (struct sockaddr*)&address, sizeof(address));
if (res == SOCKET_ERROR && !wouldBlock())
{
TCPCLOSE(_hSocket);
throw "TCP Bind error detected.";
}
The error returned is -6.
Contributor guide
Assessment
This issue has not been assessed yet.