22 memset((char *)&end_addr, 0, sizeof(end_addr)); end_addr.sin_family = AF_INET; end_addr.sin_port = htons(80); end_addr.sin_addr.s_addr = inet_addr(“192.168.2.1"); sockfd = socket(AF_INET, SOCK_STREAM, 0); int buf_size = 4096; setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, (void *)&buf_size, sizeof(int)); connect(sockfd, (struct sockaddr *)&end_addr, sizeof(end_addr)); // “sockfd” はここで既にホスト上のソケットに切り替わっている getpeername(sockfd, (struct sockaddr*)&peer_addr, &len); printf("peer: %s¥n", inet_ntoa(peer_addr.sin_addr)); sprintf(buffer, "GET / HTTP/1.1¥r¥n¥r¥n"); send(sockfd, buffer, strlen(buffer), 0); close(sockfd); 接続先は外部のエンドポイント (1) Creation (2) Configuration (3) Connection (4) Status Other syscalls (7) Close スライド: https://bit.ly/4ggWb4z