Tag:UDP server and client

  • Implementation of Linux UDP server and client program

    Time:2020-11-28

    1. Source code UDP server: /** *@ brief UDP server * @author Mculover666 * @date 2020/04/15 */ #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdlib.h> #include <string.h> int main(int argc, char* argv[]) { int server_sock_fd; struct sockaddr_in server_addr, client_addr; char recv_buf[100]; int nbytes = 0; socklen_t len = 0; […]