c语言套接字编程讲解,C语言中的套接字编程:通信样式

Being there are multiple different types of sockets available for our use, we will take a brief look at some of them. When we get to socket creation, the second argument takes a number that represents the communication style. Each number has a symbolic constant.

1. SOCK_STREAM

A socket that streams data over a connection like a cable or a pipe. It transmits data like a stream of bytes reliably.

2. SOCK_DGRAM

This style of sockets doesn't have a connection but instead, each packet is addressed and sent individually. Also, this an unreliable style of communication unlike SOCK_STREAM. Each data written to this kind of socket is converted into one packet. The only guarantee this socket gives you is it will try its best to transmit every packet you send.

3. SOCK_RAW

Most user-level programs will not use this kind of communication as it provides low-level access to protocols and interfaces.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值