1: #include <stdio.h>
2: #include <sys/types.h>
3: #include <sys/socket.h>
4: #include <netinet/in.h>
5: #include <aitio.h>
6:
7:
8: int
9: main(int argc, char **argv)
10: {
11: int s, sl;
12: struct sockaddr_in sin;
13:
14: if (argc < 3)
15: return 1;
16:
17: sin.sin_len = sizeof sin;
18: sin.sin_family = AF_INET;
19: sin.sin_port = htons(5000);
20: sin.sin_addr.s_addr = inet_addr("127.0.0.1");
21:
22: s = socket(AF_INET, SOCK_STREAM, 0);
23: if (s == -1) {
24: perror("socket");
25: return 2;
26: }
27: if (connect(s, (struct sockaddr*) &sin, sizeof sin) == -1) {
28: perror("connect");
29: close(s);
30: return 3;
31: }
32:
33: sl = ioSendFile(s, argv[1], 0, 0, argv[3] ? strtol(argv[3], NULL, 0) : 0);
34: printf("sended %d bytes\n", sl);
35: if (!sl)
36: printf("#%d - %s\n", io_GetErrno(), io_GetError());
37:
38: close(s);
39: return 0;
40: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>