[Winpcap-users] Re: accept() returns 0

Jonathan Hunt jgwehunt at gmail.com
Tue Mar 13 14:40:26 GMT 2007


Ok, I take it back, I was being stupid. I needed to bracket around  
the accept() line as shown below:

if((connected_sock = accept(drip_sock,(struct sockaddr *) 
&client_addr, &client_length)) < 0)

My stupid mistake! :)

On 13 Mar 2007, at 11:03, Jonathan Hunt wrote:

> Hi everyone
>
> I apologise for asking a non-WinPcap question, but I've got what  
> looks like a really odd bug in a  Windows XP TCP server which I'm  
> currently writing (don't worry, the client uses WinPcap!).
>
> Basically, I'm calling accept() on a listening socket, it appears  
> to be working but it's returning 0...i.e. a socket descriptor equal  
> to 0, which recv() doesn't like at all - it gives me a 10038 error,  
> meaning invalid socket!
>
> https://jonnyh.ath.cx/tapserver/TAPserver.cpp (about line 185 is  
> where it goes wrong, please ignore the rest as 98% of the file is  
> not relevant).
>
> If anyone has any advice on the matter, I'd really appreciate it,  
> as I'm quite stuck!
>
> Thanks
>
> Jonathan



More information about the Winpcap-users mailing list