一个套接字客户端程序与服务器建立连接,
使用(阻塞)read()
写入一些字节并等待响应。
但这失败了,错误为 EINVAL
(“无效参数”)。
之前对 create()
、bind()
和 connect()
套接字的调用已成功完成。
我的问题
- 这里有什么问题吗?
平台是 Linux x64。
最佳答案
fd is attached to an object which is unsuitable for reading; or the file was opened with the O_DIRECT flag, and either the address specified in buf, the value specified in count, or the current file offset is not suitably aligned.
参见 http://www.kernel.org/doc/man-pages/online/pages/man2/read.2.html
关于c - 套接字:是什么导致 read() 返回 EINVAL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6018974/