|
|
| version 1.1.2.1, 2011/11/02 16:11:09 | version 1.4, 2016/08/18 09:06:31 |
|---|---|
| Line 1 | Line 1 |
| #include <stdio.h> | #include <stdio.h> |
| #include <unistd.h> | |
| #include <sys/types.h> | #include <sys/types.h> |
| #include <sys/socket.h> | #include <sys/socket.h> |
| #include <netinet/in.h> | #include <netinet/in.h> |
| #include <arpa/inet.h> | |
| #include <aitio.h> | #include <aitio.h> |
| Line 15 main(int argc, char **argv) | Line 17 main(int argc, char **argv) |
| if (argc < 3) | if (argc < 3) |
| return 1; | return 1; |
| #ifndef __linux__ | |
| sa.sa_len = sl = sizeof sa; | sa.sa_len = sl = sizeof sa; |
| sin.sin_len = sizeof sin; | sin.sin_len = sizeof sin; |
| #endif | |
| sin.sin_family = AF_INET; | sin.sin_family = AF_INET; |
| sin.sin_port = htons(5000); | sin.sin_port = htons(5000); |
| sin.sin_addr.s_addr = inet_addr("127.0.0.1"); | sin.sin_addr.s_addr = inet_addr("127.0.0.1"); |
| Line 37 main(int argc, char **argv) | Line 41 main(int argc, char **argv) |
| return 4; | return 4; |
| } | } |
| if ((c = accept(s, &sa, &sl)) != -1) { | if ((c = accept(s, &sa, (socklen_t*) &sl)) != -1) { |
| sl = ioRecvFile(c, argv[1], strtol(argv[2], NULL, 0), 0644, argv[3] ? strtol(argv[3], NULL, 0) : 0); | sl = ioRecvFile(c, argv[1], strtol(argv[2], NULL, 0), 0644, |
| argv[3] ? strtol(argv[3], NULL, 0) : 0); | |
| printf("received %d bytes\n", sl); | printf("received %d bytes\n", sl); |
| if (!sl) | if (!sl) |
| printf("#%d - %s\n", io_GetErrno(), io_GetError()); | printf("#%d - %s\n", io_GetErrno(), io_GetError()); |