用原始套接字编的程序编译时sendto函数出现的(10004)错误

sunrainsnowjacket 2005-05-02 07:59:49
小弟用原始套接字编的程序编译时sendto函数出现的(10004)错误经查找是:WSAEINTR--(阻塞)调用被WSACancelVBlockingCall()取消,我初学网络编程不知道这样的问题该怎样解决,希望高手们帮忙指点一下,谢谢先!
我的程序的sendto()函数部分的代码:
//填充发送缓冲区
memcpy(SendBuf,&ipheader,sizeof(ipheader));

//发送TCP报文
int sendtosock=sendto(sockosscan,SendBuf,datasize,0,(struct sockaddr*)&addrremotehost,sizeof(addrremotehost));
if(sendtosock==SOCKET_ERROR)
{printf("sendto() failed:%d\n",WSAGetLastError());
return;
}

不知道是不是需要对sendto()函数添加超时程序? 请高手帮帮小弟
...全文
868 21 打赏 收藏 转发到动态 举报
写回复
用AI写文章
21 条回复
切换为时间正序
请发表友善的回复…
发表回复
sunrainsnowjacket 2005-05-16
  • 打赏
  • 举报
回复
上面这位大哥,那这个问题应该怎样解决呢?
一定要换操作系统吗?还有没有其他什么方法啊?
OpenHero 2005-05-16
  • 打赏
  • 举报
回复
首先,你先看看自己的socket创建,连接过程,是否按照那个过程写的,是tcp还是udp看清楚
最后再看是否是系统的问题
sigh02 2005-05-16
  • 打赏
  • 举报
回复
没什么办法
换吧
要么xp不打sp2
sigh02 2005-05-14
  • 打赏
  • 举报
回复
晕倒,微软的网站你都打不开??

TCP/IP
What does TCP/IP do?
Transmission Control Protocol/Internet Protocol (TCP/IP) is a suite of standard protocols for connecting computers across networks. TCP/IP enables Windows-based computers to connect and share information with other Microsoft and non-Microsoft systems.

Who does this feature apply to?
All users who use TCP/IP to connect and communicate information over a network should be aware of the changes incorporated in Windows XP Service Pack 2.

What new functionality is added to this feature in Windows XP Service Pack 2?
Restricted traffic over raw sockets
Detailed description

A very small number of Windows applications make use of raw IP sockets, which provide an industry-standard way for applications to create TCP/IP packets with fewer integrity and security checks by the TCP/IP stack. The Windows implementation of TCP/IP still supports receiving traffic on raw IP sockets. However, the ability to send traffic over raw sockets has been restricted in two ways:

• TCP data cannot be sent over raw sockets.

• UDP datagrams with invalid source addresses cannot be sent over raw sockets. The IP source address for any outgoing UDP datagram must exist on a network interface or the datagram is dropped.


Why is this change important? What threats does it help mitigate?

This change limits the ability of malicious code to create distributed denial-of-service attacks and limits the ability to send spoofed packets, which are TCP/IP packets with a forged source IP address.

sunrainsnowjacket 2005-05-13
  • 打赏
  • 举报
回复
虽然你给的网页打不开但我相信你说的话,如果用了xpsp2就真的没有办法了吗?
难道要换一个操作系统? 请上面的这个朋友给指点一下! 谢谢了!
sigh02 2005-05-12
  • 打赏
  • 举报
回复
你是不是xp装了sp2啊?
那就不行了
看看
http://www.microsoft.com/technet/prodtechnol/winxppro/maintain/sp2netwk.mspx#EIAA
上面那么多人一顿瞎说,这年头!
zxy1492 2005-05-05
  • 打赏
  • 举报
回复
vc入门的书上
一般都有socket连接的小例子
建议你看看
sunrainsnowjacket 2005-05-05
  • 打赏
  • 举报
回复
到底应该怎么样做啊?
求求各位高手啦,我初学网络编程实在是对一些问题不知道该怎么样解决!
sunrainsnowjacket 2005-05-04
  • 打赏
  • 举报
回复
我用的是原始套接字编程 会不会有影响呢?
sunrainsnowjacket 2005-05-04
  • 打赏
  • 举报
回复
是这样吗?
可是我参考的一些程序(TCP SYN扫描和其他程序)怎么发送TCP数据包的时候都是用sendto()啊。
msdn上说:
send “The Windows Sockets send function sends data on a connected socket.”

sendto “The Windows Sockets sendto function sends data to a specific destination”

并没有说 TCP用send,UDP用sendto()

各位高手可不可以再详细说明一下啊,谢谢了!
jerry 2005-05-04
  • 打赏
  • 举报
回复
TCP是有连接协议, 怎么能用 sendto ?
zxy1492 2005-05-04
  • 打赏
  • 举报
回复
TCP收用receive
发用send
有空看看msdn
SmallBigCat 2005-05-04
  • 打赏
  • 举报
回复
我狂晕
sunrainsnowjacket 2005-05-04
  • 打赏
  • 举报
回复
各位高手,我把程序改了可是还是出现那个错误啊!
是不是我的程序还是不正确啊?
//建立连接
int sockcon=connect(sockosscan,(SOCKADDR*)&addrremotehost,sizeof(addrremotehost));
if(sockcon==SOCKET_ERROR)
{printf("connect() failed:%d\n",WSAGetLastError());
return;
}
//填充发送缓冲区
memcpy(SendBuf,&ipheader,sizeof(ipheader));

//发送TCP报文
int sendtosock=send(sockosscan,SendBuf,datasize,0);
if(sendtosock==SOCKET_ERROR)
{printf("send() failed:%d\n",WSAGetLastError());
return;
}
netware 2005-05-04
  • 打赏
  • 举报
回复
在服务端:
TCP中用send,UDP用sendto()
在客户端不管是TCP还是UDP一律都是用send()
oyljerry 2005-05-04
  • 打赏
  • 举报
回复
TCP还是对应的用send
sendto用在UDP中
xuzheng318 2005-05-04
  • 打赏
  • 举报
回复
看看msdn
eliner 2005-05-03
  • 打赏
  • 举报
回复
sendto 是发送UDP报文的
send 发送TCP报文
sunrainsnowjacket 2005-05-03
  • 打赏
  • 举报
回复
我的程序是向指定的地址发送TCP数据包,可是不论指定什么地址都出现sendto()函数10004错误!
sunrainsnowjacket 2005-05-03
  • 打赏
  • 举报
回复
是TCP的!

加载更多回复(1)

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧