目标地址:61.142.108.96:9002
数据包大小:91
HEX数据:
47 45 54 20 2F 20 48 54 54 50 2F 31 2E 31 0D 0A 41 63 63 65 70 74 2D 45 6E 63 6F 64 69 6E 67 3A 20 69 64 65 6E 74 69 74 79 0D 0A 43 6F 6E 6E 65 63 74 69 6F 6E 3A 20 63 6C 6F 73 65 0D 0A 55 73 65 72 2D 41 67 65 6E 74 3A 20 44 72 2E 43 4F 4D 20 43 6C 69 65 6E 74 0D 0A 0D 0A
ASCII数据:
GET./.HTTP/1.1..Accept-Encoding:.identity..Connection:.close..User-Agent:.Dr.COM.Client....
麻烦些详细一点,给一些文字说明哈
c++写一个封包发送源代码
答案:2 悬赏:80 手机版
解决时间 2021-03-14 13:45
- 提问者网友:我是女神我骄傲
- 2021-03-14 01:07
最佳答案
- 五星知识达人网友:老鼠爱大米
- 2021-03-14 02:15
SOCKET tcpConnect(char* IP, int port) //TCP连接函数
{
DWORD ip = inet_addr(IP);
SOCKET sock;
sock = socket(AF_INET, SOCK_STREAM, 0);
if(sock == INVALID_SOCKET)
return sock;
sockaddr_in sin;
sin.sin_addr.s_addr = ip;
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
if(connect(sock, (sockaddr *)&sin, sizeof(sin)) == SOCKET_ERROR)
{
closesocket(sock);
return INVALID_SOCKET;
}
return sock;
}int WinMain()
{
char* data="GET./.HTTP/1.1..Accept-Encoding:.identity..Connection:.close..User-Agent:.Dr.COM.Client....";
WSADATA wsaData = {0};
WSAStartup(MAKEWORd(2, 2), &wsaData);
SOCKET tcp294261691 = tcpConnect("61.142.108.96",9002);
send(tcp29426169,data,sizeof(data)*sizeof(char),0);
closesocket(tcp294261691);
}
写了一会,,,,多给点分.
{
DWORD ip = inet_addr(IP);
SOCKET sock;
sock = socket(AF_INET, SOCK_STREAM, 0);
if(sock == INVALID_SOCKET)
return sock;
sockaddr_in sin;
sin.sin_addr.s_addr = ip;
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
if(connect(sock, (sockaddr *)&sin, sizeof(sin)) == SOCKET_ERROR)
{
closesocket(sock);
return INVALID_SOCKET;
}
return sock;
}int WinMain()
{
char* data="GET./.HTTP/1.1..Accept-Encoding:.identity..Connection:.close..User-Agent:.Dr.COM.Client....";
WSADATA wsaData = {0};
WSAStartup(MAKEWORd(2, 2), &wsaData);
SOCKET tcp294261691 = tcpConnect("61.142.108.96",9002);
send(tcp29426169,data,sizeof(data)*sizeof(char),0);
closesocket(tcp294261691);
}
写了一会,,,,多给点分.
全部回答
- 1楼网友:风格不统一
- 2021-03-14 03:50
没看懂什么意思?
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯