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
35
36
37
38
39
40
|
lyr@DESKTOP-FSVN6C0:~$ grep add ./
grep: ./: 是一个目录
lyr@DESKTOP-FSVN6C0:~$ grep add ./*
./client.cpp: struct sockaddr_in serv;
./client.cpp: //serv.sin_addr.s_addr = htonl(INADDR_ANY); //使用本机任意可用IP
./client.cpp: inet_pton(AF_INET, "127.0.0.1",&serv.sin_addr.s_addr);
./client.cpp: //printf("[%p]", serv.sin_addr.s_addr);
./client.cpp: int ret = connect(cfd,(struct sockaddr *)&serv, sizeof serv);
./main.cpp: struct sockaddr_in serv;
./main.cpp: serv.sin_addr.s_addr = htonl(INADDR_ANY); //使用本机任意可用IP
./main.cpp: int ret = bind(lfd,(struct sockaddr *)&serv,sizeof serv);
./test.sh:add 1 1
lyr@DESKTOP-FSVN6C0:~$ grep add.* ./*
./client.cpp: struct sockaddr_in serv;
./client.cpp: //serv.sin_addr.s_addr = htonl(INADDR_ANY); //使用本机任意可用IP
./client.cpp: inet_pton(AF_INET, "127.0.0.1",&serv.sin_addr.s_addr);
./client.cpp: //printf("[%p]", serv.sin_addr.s_addr);
./client.cpp: int ret = connect(cfd,(struct sockaddr *)&serv, sizeof serv);
./main.cpp: struct sockaddr_in serv;
./main.cpp: serv.sin_addr.s_addr = htonl(INADDR_ANY); //使用本机任意可用IP
./main.cpp: int ret = bind(lfd,(struct sockaddr *)&serv,sizeof serv);
./test.sh:add 1 1
lyr@DESKTOP-FSVN6C0:~$ grep "add.*|bind" ./*
lyr@DESKTOP-FSVN6C0:~$ grep "add.*|sock" ./*
lyr@DESKTOP-FSVN6C0:~$ grep "add|sock" ./*
lyr@DESKTOP-FSVN6C0:~$ grep -E "add|sock" ./*
./client.cpp: int cfd = socket(AF_INET, SOCK_STREAM, 0);
./client.cpp: perror("socket error");
./client.cpp: struct sockaddr_in serv;
./client.cpp: //serv.sin_addr.s_addr = htonl(INADDR_ANY); //使用本机任意可用IP
./client.cpp: inet_pton(AF_INET, "127.0.0.1",&serv.sin_addr.s_addr);
./client.cpp: //printf("[%p]", serv.sin_addr.s_addr);
./client.cpp: int ret = connect(cfd,(struct sockaddr *)&serv, sizeof serv);
./main.cpp: int lfd = socket(AF_INET, SOCK_STREAM, 0);
./main.cpp: perror("socket error");
./main.cpp: struct sockaddr_in serv;
./main.cpp: serv.sin_addr.s_addr = htonl(INADDR_ANY); //使用本机任意可用IP
./main.cpp: int ret = bind(lfd,(struct sockaddr *)&serv,sizeof serv);
./test.sh:add 1 1
lyr@DESKTOP-FSVN6C0:~$
|