唉,最近好不容易想要用低階socket作一些網路偵測功能
拿了一些code來參考,寫了一堆,結果都不能用
花了一整天時間,才查到原因.............
原來win2k sp2版本後,因為安全需求,把raw socket的TCP封包與source IP不是本機IP的UDP封包
都禁止使用了
阿,還是用libpacp吧,殘念
================================網路上的討論
Asunto: Re: sendto() 10004 error
De: arkadyf@hotmailxdotx.com (Arkady Frenkel)
Foro: microsoft.public.platformsdk.networking
Organización: Texas Instruments
Fecha: 24. Aug 2004, 09:41:48
Referencia: 1 2 3
Thanks for URL , Alun ! That shows that protection against dos attacks much
more sophisticated that I thought before :)
Arkady
"Alun Jones [MSFT]" wrote in message
news:%23ASKt2UiEHA.1384@TK2MSFTNGP10.phx.gbl...
> Specifically, raw TCP sends are forbidden. Raw UDP sends that forge the
> source address are also forbidden. Other raw socket sends work just fine.
>
> For details, see
>
.mspx#XSLTsection127121120120>
>
> Alun.
> ~~~~
>
> "Arkady Frenkel" wrote in message
> news:eX3HKd7hEHA.2604@TK2MSFTNGP09.phx.gbl...
> > Raw socket send operation forbidden in SP2 , that part of struggle with
> > DOS ( deny of service ) attacks
> > Arkady
> >
> > "R-e-D" wrote in message
> > news:XnF954C8560D604Dredredkodorg@212.27.42.66...
> > > Hello,
> > >
> > > When I call sendto() in order to send my packet this error appears:
> > >
> > > "Une opération de blocage a été interrompue par un appel
> > > à WSACancelBlockingCall", Code 10004
> > >
> > > This problem is present since the installation of the Service Pack 2
> > > of Windows XP.
> > >
> > > Code:
> > > SOCKET sock;
> > > ....
> > > sock = WSASocket(AF_INET, SOCK_RAW, IPPROTO_TCP, NULL, 0,
> > > WSA_FLAG_OVERLAPPED); ....
> > > setsockopt(sock, IPPROTO_IP, IP_HDRINCL, (char *) &optval,
> > > sizeof(optval)); ....
> > > bytes_sent = sendto(sock, packet, len, 0, to, sizeof(struct
> > > sockaddr_in)); if (bytes_sent == SOCKET_ERROR || bytes_sent != len)
> > > ....
> > > Error !
> > >
> > >
> > > Would somebody have a solution ?
> > > Sorry for my english.
> > >
請先 登入 以發表留言。