connect()
#include <sys/types.h>
#include <sys/socket.h>
The connect() system call connects the socket referred to by the file descriptor sockfd to the address specified by addr. The addrlen argument specifies the size of addr. The format of the address in addr is determined by the address space of the socket sockfd; see socket(2) for further details.
If the socket sockfd is of type SOCK_DGRAM then addr is the address to which datagrams are sent by default, and the only address from which datagrams are received. If the socket is of type SOCK_STREAM or SOCK_SEQPACKET, this call attempts to make a connection to the socket that is bound to the address specified by addr.
Generally, connection-based protocol sockets may successfully connect() only once; connectionless protocol sockets may use connect() multiple times to change their association. Connectionless sockets may dissolve the association by connecting to an address with the sa_family member of sockaddr set to AF_UNSPEC (supported on Linux since kernel 2.2).
If the connection or binding succeeds, zero is returned. On error, -1 is returned, and errno is set appropriately.
最新文章
- asp.net获取服务器绝对路径和相对路径
- React Native 组件样式测试
- sql 中 in与exists的对比
- [蓝牙] 4、Heart Rate Service module
- 配置DB2的数据库ODBC连接
- linux复制多个文件到文件夹
- [一]初识Json
- UVA 712-S-Trees(满二叉树的简单查询)
- HTTP 响应
- 回调函数 use
- WebGL多模型光照综合实例
- Photoshop给人像加上个性裂纹肌肤
- C#.NET开源项目、机器学习、Power BI
- JavaScript中,JSON格式的字符串与JSON格式的对象相互转化
- 10 Tips for Writing Better Code (阅读理解)
- 《剑指offer》 大数递增
- 内置函数id,返回内存地址
- 使用RxSwift 实现登录页面的条件绑定
- MySQL查询表结构命令
- maven(2)------maven构建项目
热门文章
- 【二分答案】bzoj1639 [Usaco2007 Mar]Monthly Expense 月度开支
- 【可持久化Trie】模板
- 1.3(Spring学习笔记)Spring-AOP
- pythonGUI编程打开默认浏览器
- md5代码实现
- iOS:CocosPods的装配和配置ReactiveCocoa
- 用ghost备份和还原Linux系统
- linux基础-第二十单元_计划任务crond服务
- makefile opencv的案例
- http://blog.chinaunix.net/uid-20577907-id-3519578.html