emscripten-core / emscripten-core/emscripten

Unable to connect to a WebSocket server using the posix socket api in a web worker thread.

Open
#14,318 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.