用户工具

站点工具


linux:socket编程

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
后一修订版
前一修订版
linux:socket编程 [2023/02/21 09:05] – zhangguolinux:socket编程 [2026/10/13 22:51] (当前版本) – 外部编辑 127.0.0.1
行 1: 行 1:
  
-====== socket编程 ====== +# socket编程 
-===== - socket 学习 =====+## - socket 学习 
 +[Unix Socket - Core Functions](https://www.tutorialspoint.com/unix_sockets/socket_core_functions.htm)
  
-[[https://www.geeksforgeeks.org/socket-programming-cc/|Socket Programming in C/C++]]+[Socket Programming in C/C++](https://www.geeksforgeeks.org/socket-programming-cc/)
  
-[[https://www.binarytides.com/socket-programming-c-linux-tutorial/|Socket programming in C on Linux – The Ultimate Guide for Beginners]]+[Socket programming in C on Linux – The Ultimate Guide for Beginners](https://www.binarytides.com/socket-programming-c-linux-tutorial/)
  
 +### - 大图
 +![:linux:pasted:20230221-092340.png](:linux:pasted:20230221-092340.png)
  
-{{:linux:pasted:20230221-085436.png}}+![:linux:pasted:20230221-085436.png](:linux:pasted:20230221-085436.png)
  
-<code>+ 
 +#### - recv,read 
 + 
 +``` 
 +Returns the number of bytes actually recieved (which might be less than you requested in the 
 +len paramter), or -1 on error (and errno will be set accordingly.) 
 +If the remote side has closed the connection, recv() will return 0. This is the normal method 
 +for determining if the remote side has closed the connection. 
 +``` 
 +  
 + 
 +### - function 
 + 
 +```
 1. Socket creation: 1. Socket creation:
 int sockfd = socket(domain, type, protocol) int sockfd = socket(domain, type, protocol)
行 179: 行 195:
  
 Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
 +```
  
  
-</code> 
- 
- 
-===== - 示例代码 ===== 
  
 +## - 示例代码
 参考: https://blog.csdn.net/liranke/article/details/6079393/ 参考: https://blog.csdn.net/liranke/article/details/6079393/
  
 这个代码在linux系统下可直接使用,同样也适于xilinx zynq petalinx下使用。 这个代码在linux系统下可直接使用,同样也适于xilinx zynq petalinx下使用。
  
-==== - 服务端代码 ====+### - 服务端代码
  
-<code c>+```c
  
 #include <stdio.h> #include <stdio.h>
行 270: 行 284:
     return 0;     return 0;
 } }
 +```
  
-</code> 
  
  
  
-==== - 客户端代码 ====+### - 客户端代码
  
-<code c>+```c
 #include <stdio.h> #include <stdio.h>
 #include <stdlib.h> #include <stdlib.h>
行 325: 行 339:
     return 0;     return 0;
 } }
 +```
  
-</code> 
linux/socket编程.1676941527.txt.gz · 最后更改: (外部编辑)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki