套接字编程中非法查找的可能原因
Probable reasons for Illegal seek in socket programming
在发送数据时收到以下错误:
发送:29-Illegal找
请解释可能的原因。我是套接字编程的新手。提前谢谢。
CHAR datasend[200];
DOUBLE64 fTime=0.0;
LONG32 sent_bytes=0;
while(TRUE)
{
memset(datasend,0,200);
fTime=getTime();
sprintf(datasend,"0=%.0lf ",fTime);
sent_bytes = send ( isockfd, datasend, strlen(datasend),0);
logDebug1("Pulse is %s and data bytes is %d",datasend,strlen(datasend));
if(sent_bytes <= 0)
{
logPError("send");
logTimestamp("Closing socketn");
close(isockfd);
return NULL;
}
sleep(25);
}
由于中间的logDebug1
调用,您没有解释正确的错误
- 你有一个返回值为<= 0的
send
可能还有一个可以检查的errno
- 您打印的东西(
logDebug1
) 可能会击败errno
- 你做一些
perror
来解释被破坏的errno
你要做的是检查是否sentBytes < 0
, perror
立即,然后可能打印更多调试的东西,如果你想。
相关文章:
- 正在查找文档以获得PS4平台的C++中的设备信息
- 在C++中查找文件
- 模板元程序查找相似的连续类型名称
- 在UNIX系统中使用DIR查找文件的字节大小
- 有一个打印语句的函数是一种糟糕的编程实践吗
- 查找最接近的大于当前数字的数字的索引
- 有没有一种方法可以创建一个带有哈希表的数据库,该哈希表具有恒定时间查找功能
- 如何以编程方式查找加载的共享库的版本?
- 如何以编程方式查找 Windows 上的活动安全提供程序
- 如何以编程方式查找从 html 引用的所有文件
- 如何在C / C++中以编程方式查找"Saved Games"文件夹?
- 通过编程C MFC查找目录中的文件列表
- 如何以编程方式查找计算机的域
- C 编程 - 查找第一个文件返回Invalid_handle_value
- 如何使用本机代码以编程方式查找Java本地变量的内存地址
- 使用c++ 11在编译时以编程方式查找端序
- 在进行套接字编程时,查找域名然后连接到它的正确方法是什么?
- C++套接字编程 - 查找客户端计算机 IP、TrueIP 和绑定端口
- 编程语言思想:避免虚参表查找
- 套接字编程中非法查找的可能原因