Who could help me about sniffer?

G

Guest

Guest
Archived from groups: microsoft.public.windowsnt.protocol.tcpip (More info?)

I write a program and it run in win2k,I want to get the tcp packet,look:
void main()
{
int nByte;
char buf[35565];
struct sockaddr from;
int fromlen
//start winsock;I omit them
SOCKET sk=socket(AF_INET,SOCK_RAW,IPPROTO_TCP);
while(1)
{
nByte=recvfrom(sk,buf,sizeof(buf),0,&from,&fromlen);
}
}
I can success to compile this program,when it run,the error occur,who
can help me?thank you.
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsnt.protocol.tcpip (More info?)

Just take from www.codeguru.com/network/ipmon.html to compare.
The better place to ask such questions -
microsoft.public.win32.programmer.networks
Arkady

"LeeTow" <fbjlt@pub3.fz.fj.cn> wrote in message
news:%23b89HyiTFHA.3188@TK2MSFTNGP09.phx.gbl...
>I write a program and it run in win2k,I want to get the tcp packet,look:
> void main()
> {
> int nByte;
> char buf[35565];
> struct sockaddr from;
> int fromlen
> //start winsock;I omit them
> SOCKET sk=socket(AF_INET,SOCK_RAW,IPPROTO_TCP);
> while(1)
> {
> nByte=recvfrom(sk,buf,sizeof(buf),0,&from,&fromlen);
> }
> }
> I can success to compile this program,when it run,the error occur,who
> can help me?thank you.
>
>