2024年3月22日发(作者:)

46 return 0;

47 }

48

49 char sPrint[sizeof(szBuf)];

50 sprintf(sPrint, "recv msg: %s ",szBuf);//格式化字符串

51 printf(sPrint);

52 if(strcmp(szBuf, "close") == 0){ // 检测退出

53 nRet = send(hClient,"close",strlen("close"), 0);

54 break;

55 }

56 else{

57 //接收到数据

58 if (strcmp(szBuf, "helllllllooooooo") == 0){

59 send(hClient, "wow", sizeof("wow"),0);

60 }

61 }

62

63

64 }

65 closesocket(hClient);

66 WSACleanup();

67

68 return 0;

69 }