1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-08-07 08:02:56 +03:00

Fix example/direct_tcpip.c to work also on WIN32

read() and write() are no good for WIN32 sockets, use recv() and send().
This commit is contained in:
Peter Stuge
2010-01-30 00:35:05 +01:00
parent 2622bbaf33
commit e4b7baa885

View File

@@ -206,7 +206,7 @@ int main(int argc, char *argv[])
goto shutdown;
}
if (rc && FD_ISSET(forwardsock, &fds)) {
len = read(forwardsock, buf, sizeof(buf));
len = recv(forwardsock, buf, sizeof(buf), 0);
if (len < 0) {
perror("read");
goto shutdown;
@@ -234,7 +234,7 @@ int main(int argc, char *argv[])
}
wr = 0;
while (wr < len) {
i = write(forwardsock, buf + wr, len - wr);
i = send(forwardsock, buf + wr, len - wr, 0);
if (i <= 0) {
perror("write");
goto shutdown;