C++????TCP??UDP??socket???
???????????? ???????[ 2015/10/8 11:21:43 ] ????????.NET ???????????
??????????
#include <stdio.h>
#include <Winsock2.h>
#pragma comment( lib?? "ws2_32.lib" )
void main()
{
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 1?? 1 );//????????????λ????????????????λ???
err = WSAStartup( wVersionRequested?? &wsaData );//??winsock DLL??????????????????г??????Э??Winsock??汾???????????????????
if ( err != 0 )
{
return;
}
if ( LOBYTE( wsaData.wVersion ) != 1 ||HIBYTE( wsaData.wVersion ) != 1 )//LOBYTE???????16????????λ??HIBYTE???????16????????????????????????
{
WSACleanup( );
return;
}
for(int index=0;;index++)
{
SOCKET sockClient=socket(AF_INET??SOCK_STREAM??0);
SOCKADDR_IN addrClt;//????????????IP???
addrClt.sin_addr.S_un.S_addr=inet_addr("192.168.0.30");// inet_addr??IP??????????????????????????????
addrClt.sin_family=AF_INET;
addrClt.sin_port=htons(4000);
connect(sockClient??(SOCKADDR*)&addrClt??sizeof(SOCKADDR));//????????????????????????
char recvBuf[50];
recv(sockClient??recvBuf??50??0);
printf("my reply is : %s "??recvBuf);
char sendBuf[50];
sprintf(sendBuf??"%3d??"??index);
strcat(sendBuf??"server node of: yaopeng");
send(sockClient??sendBuf??strlen(sendBuf)+1??0);
closesocket(sockClient);
Sleep(2000);
}
WSACleanup();
}
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
??C++????????????C++ lvalue??rvalueC++11????????C++???????????????C++?е?????????????????C++?????????C++???Windows????λ??C/C++???????????????????JAVA??C??C++??????????c++??python???????????????????????????????C++???????C++?е????????C++????????????????C++ ???????????????C++?????????????????????C++????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????