当前位置:网站首页>Connect function usage of socket
Connect function usage of socket
2022-06-22 20:05:00 【Tao song remains the same】
Look at the source code , See such a piece of code :
static int connSocketConnect(connection *conn, const char *addr, int port, const char *src_addr,
ConnectionCallbackFunc connect_handler) {
int fd = anetTcpNonBlockBestEffortBindConnect(NULL,addr,port,src_addr);
if (fd == -1) {
conn->state = CONN_STATE_ERROR;
conn->last_errno = errno;
return C_ERR;
}
conn->fd = fd;
conn->state = CONN_STATE_CONNECTING;
conn->conn_handler = connect_handler;
aeCreateFileEvent(server.el, conn->fd, AE_WRITABLE,
conn->type->ae_handler, conn);
return C_OK;
}
Timeout in implementation connect When , So often , need set nonblock socket
边栏推荐
- 元宇宙怎么就这么火,市场喊起来的10万亿是吹嘘还是真相?
- Openpnp debugging ------ 0816 Feida Tui 0402 taping
- [deeply understand tcapulusdb technology] how to initialize and launch tcapulusdb machine
- A text to show you the memory leak
- [deeply understand tcapulusdb technology] how to start tcapulusdb process
- 希尔排序
- Modify the antd tree component so that its subclasses are arranged horizontally.
- Antd tree tree tree selector subclass required
- Interpolation lookup and half (bisection) lookup
- 冒泡排序、选择排序、直接插入排序
猜你喜欢

Redis中的Multi事务

基于Sentinel的高可用限流系统的Grafana报表展示

Zabbix学习笔记(三十七)

使用 qrcodejs2 生成二维码详细API和参数

Search, insert and delete of binary sort tree
![[in depth understanding of tcapulusdb technology] introduction tcapulusdb problem summary](/img/2b/3ab5e247ac103728b4d3579c3c5468.png)
[in depth understanding of tcapulusdb technology] introduction tcapulusdb problem summary

Storage structure of graph (adjacency matrix)
![Summer Challenge [FFH] Hongmeng machine learning journey from scratch NLP emotion analysis](/img/e8/3b6de6445c9a78f33c8e91c2ff5517.png)
Summer Challenge [FFH] Hongmeng machine learning journey from scratch NLP emotion analysis

What can the accelerated implementation of digital economy bring to SMEs?

不断重修的计划与变化
随机推荐
[deeply understand tcapulusdb technology] tcapulusdb operation and maintenance - daily inspection
散列表(哈希表)
[deeply understand tcapulusdb technology] how to start tcapulusdb process
使用 qrcodejs2 生成二维码详细API和参数
Huffman tree (C language)
Install some office tools
MySQL约束
漫话Redis源码之一百一二十
卡尔加里大学|基于强化学习的推荐系统综述
libcef最新下载地址-在VS2015下编译为MD-动态链接
R语言data.table导入数据实战:data.table数据列名称的重命名(rename)
MySQL数据库DQL练习题
[in depth understanding of tcaplus DB technology] getting started tcaplus SQL driver
[deeply understand tcapulusdb technology] tcapulusdb table management - clean up table
[in depth understanding of tcapulusdb technology] new models of tcapulusdb
【深入理解TcaplusDB技术】运维平台中实现TcaplusDB事务管理
记可视化项目代码设计的心路历程以及理解
【深入理解TcaplusDB技术】入门Tcaplus SQL Driver
[in depth understanding of tcapulusdb technology] tcapulusdb operation and maintenance doc
[deeply understand tcapulusdb technology] realize tcapulusdb transaction management in the operation and maintenance platform