特点 模块非常简洁,提供了监听指定端口,链接指定地址,读,写网络句柄等功能 重要的接口函数 监听指定端口 int anetTcpServer(char *err, int port, char *bindaddr) { int s, on = 1; struct sockaddr_in sa; if ((s = socket(AF_INET, SOCK_STREAM,
数据结构 typedef struct dictEntry { void *key; void *val; struct dictEntry *next; } dictEntry; /* This is our hash table structure. Every dictionary has two of this as we * implement incremental rehashing, for the old to the new table. */ typedef struct dictht { dictEntry **table; unsigned long size; unsigned long sizemask; unsigned long used; } dictht; typedef struct dict { dictType *type; void *privdata; dictht