UDP通信recvfrom返回invalid argument
2016-12-09 19:54
323 查看
//原文地址:http://blog.chinaunix.net/uid-26497520-id-3891017.html
这个问题很可能出在addrlen参数上,以下是man文档的解释
If src_addr is not NULL, and the underlying protocol provides the
source address, this source address is filled in. When src_addr is
NULL, nothing is filled in; in this case, addrlen is not used, and
should also be NULL. The argument addrlen is a value-result argument,
which the caller should initialize before the call to the size of the
buffer associated with src_addr, and modified on return to indicate the
actual size of the source address. The returned address is truncated
if the buffer provided is too small; in this case, addrlen will return
a value greater than was supplied to the call.
自注: 大冬天的在工厂调试,遇到这种问题也是醉了
这个问题很可能出在addrlen参数上,以下是man文档的解释
If src_addr is not NULL, and the underlying protocol provides the
source address, this source address is filled in. When src_addr is
NULL, nothing is filled in; in this case, addrlen is not used, and
should also be NULL. The argument addrlen is a value-result argument,
which the caller should initialize before the call to the size of the
buffer associated with src_addr, and modified on return to indicate the
actual size of the source address. The returned address is truncated
if the buffer provided is too small; in this case, addrlen will return
a value greater than was supplied to the call.
自注: 大冬天的在工厂调试,遇到这种问题也是醉了
相关文章推荐
- shmget 返回 -1, Invalid argument
- sendto 返回-1,errno为22,invalid argument的解决办法,mark一下
- java.lang.IllegalArgumentException: An invalid domain [.test.com] was specified for this cookie
- 报tensorflow.python.framework.errors.InvalidArgumentError:Node'save/restore_slice_2':错误的解决方案
- php foreach Invalid argument supplied for foreach()
- pefile under python 2.4 (centos os ) EnvironmentError: [Errno 22] Invalid argument
- 消息队列通信msgsnd函数时一直invalid argument
- 返回E_INVALIDARG (0x80070057)
- hwclock: RTC_SET_TIME: Invalid argument
- dd: opening `/dev/zero': Invalid argument的错误原因
- php下foreach()错误提示Warning: Invalid argument supplied for foreach()
- accept: Invalid argument
- 解决FTP返回“425 Sorry ,invalid address given”的错误
- tensowflow报错tensorflow.python.framework.errors_impl.InvalidArgumentError<exception str
- Error:dojo.data.ItemFileWriteStore:Invalid item argument
- 使用setsockopt()接口,设置TCP的接收与发送超时,Invalid argument错误问题
- foreach的参数不是数组:Warning: Invalid argument supplied for foreach
- jpa语句报 org.springframework.dao.InvalidDataAccessApiUsageException: Parameter with that position [2] did not exist; nested exception is java.lang.IllegalArgumentException: Parameter with that position
- -bash: ulimit: pipe size: cannot modify limit: Invalid argument
- java.lang.IllegalArgumentException: Page directive: invalid value for import