Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion examples/07netcat.strm
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
s = tcp_socket("localhost", 8007)
stdin | s
s | stdout
stdin | s
3 changes: 2 additions & 1 deletion src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# include <sys/socket.h>
#else
# include <ws2tcpip.h>
# include <fcntl.h>
#endif
#include <sys/stat.h>

Expand Down Expand Up @@ -334,7 +335,7 @@ strm_writeio(strm_io io)
#ifdef _WIN32
WSANETWORKEVENTS wev;
if (WSAEnumNetworkEvents((SOCKET) io->fd, NULL, &wev) == 0) {
d->f = fdopen(_open_osfhandle(io->fd, 0), "w");
d->f = fdopen(_open_osfhandle(io->fd, _O_RDONLY), "w");
} else
d->f = fdopen(io->fd, "w");
#else
Expand Down
1 change: 0 additions & 1 deletion src/pollfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ epoll_wait(int epfd, struct epoll_event* events, int maxevents, int timeout)
} else {
HANDLE h = (HANDLE) _get_osfhandle(ee->fds[i]);
if (h != INVALID_HANDLE_VALUE && WaitForSingleObject(h, 0) == WAIT_OBJECT_0) {
memcpy(&events[e++], ee, sizeof(struct epoll_event));
events[e++] = *ee;
if (ee->events & EPOLLONESHOT)
ee->fds[i] = -1;
Expand Down
2 changes: 2 additions & 0 deletions src/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,10 @@ tcp_socket(strm_stream* task, int argc, strm_value* args, strm_value* ret)
strm_string host;

#ifdef _WIN32
int sockopt = SO_SYNCHRONOUS_NONALERT;
WSADATA wsa;
WSAStartup(MAKEWORD(2, 0), &wsa);
setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *)&sockopt, sizeof(sockopt));
#endif

if (argc != 2) {
Expand Down