Server side #include <sys/types.h> #include <sys/socket.h> #include <unistd.h> #include
<stdio.h> #include <arpa/inet.h> int main() { //socket int cliFd =
socket(PF_INET, SOCK_STREAM, 0); if(cliFd < 0) { perror("socket error!");
return -1; } printf("socket ok!\n"); //connect struct sockaddr_in servAddr =
{0}; servAddr.sin_family = PF_INET; servAddr.sin_port = htons(8888);
servAddr.sin_addr.s_addr = inet_addr("192.168.31.100"); int ret =
connect(cliFd, (struct sockaddr *)&servAddr, sizeof(servAddr)); if(ret < 0) {
perror("connect error!"); return -1; } printf("connect ok!\n"); //send char
buf[1024] = {0}; printf("please input:"); scanf("%s", buf); send(cliFd, buf,
sizeof(buf), 0); //close close(cliFd); return 0; }
terminal #include <sys/types.h> #include <sys/socket.h> #include <stdio.h> #include
<arpa/inet.h> #include <unistd.h> int main() { //socket int servFd =
socket(PF_INET, SOCK_STREAM, 0); if(servFd < 0) { perror("socket error!");
return -1; } printf("socket ok!\n"); //bind struct sockaddr_in servAddr = {0};
servAddr.sin_family = PF_INET; servAddr.sin_port = htons(8888);
servAddr.sin_addr.s_addr = inet_addr("192.168.31.100"); int ret = bind(servFd,
(struct sockaddr *)&servAddr, sizeof(servAddr)); if(ret < 0) { perror("bind
error!"); return -1; } printf("bind ok!\n"); //listen ret = listen(servFd, 10);
if(ret < 0) { perror("listen error!"); return -1; } printf("listening.....\n");
//accept int connFd = accept(servFd, NULL, NULL); if(connFd < 0) {
perror("accept error!"); return -1; } printf("accept ok!\n"); //recv char
buf[1024] = {0}; ret = recv(connFd, buf, sizeof(buf), 0); if(ret > 0) {
printf("recv form client: %s\n", buf); } //close close(servFd); close(connFd);
return 0; }

Technology
©2019-2020 Toolsou All rights reserved,
el-ui:select Get value LED Scrolling text Online troubleshooting HTTP Status code ——415 and 406【JAVA】【 Huawei campus recruitment written examination - Software 】2020-09-09element ui Drop down box search function pytorch of ResNet18( Yes cifar10 The accuracy of data classification is achieved 94%)ElementUI In the select Of label value use VS2019 “Windows Desktop applications ” Module creation Win32 window Fiddler Simulate request sending and modifying response data ( Essence )2020 year 8 month 15 day redis database StackExchange.Redis in Set type (C# edition )