forked from unpbook/unpv13e
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tcpsend01.lc
34 lines (25 loc) · 1.35 KB
/
tcpsend01.lc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "unp.h"## 1 ##src/oob/tcpsend01.c##
int## 2 ##src/oob/tcpsend01.c##
main(int argc, char **argv)## 3 ##src/oob/tcpsend01.c##
{## 4 ##src/oob/tcpsend01.c##
int sockfd;## 5 ##src/oob/tcpsend01.c##
if (argc != 3)## 6 ##src/oob/tcpsend01.c##
err_quit("usage: tcpsend01 <host> <port#>");## 7 ##src/oob/tcpsend01.c##
sockfd = Tcp_connect(argv[1], argv[2]);## 8 ##src/oob/tcpsend01.c##
Write(sockfd, "123", 3);## 9 ##src/oob/tcpsend01.c##
printf("wrote 3 bytes of normal data\n");## 10 ##src/oob/tcpsend01.c##
sleep(1);## 11 ##src/oob/tcpsend01.c##
Send(sockfd, "4", 1, MSG_OOB);## 12 ##src/oob/tcpsend01.c##
printf("wrote 1 byte of OOB data\n");## 13 ##src/oob/tcpsend01.c##
sleep(1);## 14 ##src/oob/tcpsend01.c##
Write(sockfd, "56", 2);## 15 ##src/oob/tcpsend01.c##
printf("wrote 2 bytes of normal data\n");## 16 ##src/oob/tcpsend01.c##
sleep(1);## 17 ##src/oob/tcpsend01.c##
Send(sockfd, "7", 1, MSG_OOB);## 18 ##src/oob/tcpsend01.c##
printf("wrote 1 byte of OOB data\n");## 19 ##src/oob/tcpsend01.c##
sleep(1);## 20 ##src/oob/tcpsend01.c##
Write(sockfd, "89", 2);## 21 ##src/oob/tcpsend01.c##
printf("wrote 2 bytes of normal data\n");## 22 ##src/oob/tcpsend01.c##
sleep(1);## 23 ##src/oob/tcpsend01.c##
exit(0);## 24 ##src/oob/tcpsend01.c##
}## 25 ##src/oob/tcpsend01.c##