[Winpcap-users] Winpcap and Sockets

Ian Basham ianb at proconex.com
Mon Mar 19 19:31:03 GMT 2007


Hi,

We are having a problem with Winpcap and Sockets.  I found a post from 
Aug 28 2006 that implies there should be no problem with sockets and 
Winpcap, and yet....


In one part of our program, we are setting up a socket as follows (some 
details omitted):
  - call WSAStartup
  - call socket
  - call bind
  - call listen
  - call accept

Now another computer communicates with our program over that socket.  
When it finishes, the connection is closed down.  Our program  then does 
the following:

  - call shutdown
  - call closesocket
  - call WSACleanup

This tears down the socket connection.  Then we start another socket all 
over again with:
  - call WSAStartup
  - call socket
  - call bind
  - call listen
  - call accept
 
So far so good.  This has been working for many years.  The other 
computer has no problem communicating with our program. 

Now the problem.  If we call pcap_open, then pcap_close,  the socket 
portion of our program fails.  Specifically, the call to bind fails with 
WSAEADDRINUSE.

This occurs on WinXP, with Winpcap 3.1 and 4, using MS Visual C++ 6.0.

Does anyone have any idea what is going on here?

Thanks,

Ian B.


More information about the Winpcap-users mailing list