Advertisement

测试UDP端口(udp_sender.c, UDPEchoServer.cpp)

阅读量:
  • UdpTest.cpp
复制代码
 /* * On client:
    
 * gcc udp_test_windows.c -o udp_test_windows -lws2_32
    
 * ./udp_tset_windows x.x.x.x 4665 # Replace x.x.x.x with your server IP address
    
 * On server:
    
 * sudo tcpdump -i any udp port 4665 -nn -XX
    
 */
    
 #include <stdio.h>
    
 #include <stdlib.h>
    
 #include <string.h>
    
 #include <winsock2.h>
    
 #include <ws2tcpip.h>
    
  
    
 #pragma comment(lib, "Ws2_32.lib")
    
  
    
 int sendUdp(const char *ip, unsigned short port, const char *message) {
    
     WSADATA wsaData;
    
     SOCKET sockfd;
    
     struct soc

全部评论 (0)

还没有任何评论哟~