- 665
- 0
- 约2.22千字
- 约 5页
- 2018-05-05 发布于河南
- 举报
linux下用终端访问百度网站
linux下用终端访问百度网站
// http.c
#include stdio.h
#include stdlib.h
#include string.h
#include unistd.h
#include sys/types.h
#include sys/socket.h
#include netinet/in.h
#include arpa/inet.h
#define BUFSIZE 10240
int main(int argc, char *argv[]) {
if (argc != 3) {
printf(Parameter(s): Server Address Server Port Echo Word\n);
exit(1);
}
char *servIP = argv[1];
in_port_t servPort = atoi(argv[2]);
char *echoString = GET / HTTP/1.1\nHost: \nUser-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) GeckoFirefox/1.0.1\nConnection: Keep-Alive\n\n;
原创力文档

文档评论(0)