0

I have a desktop application which use MySQL database. The application worked fine unless I add a new dependency which is a dll library which communicates with special hardware using socket. This new library call WSAStartup and WSACleanup to start and stop communication with the hardware.

But sometimes the connection to MySQL database is interrupted as well.

What are the guidelines for application which use more than one dependency working with winsockets?

Should these libraries call WSAStartup and WSACleanup?

MD XF
  • 7,860
  • 7
  • 40
  • 71
Tomas Kubes
  • 23,880
  • 18
  • 111
  • 148
  • 2
    The "sometimes" clause doesn't help much. But you have an indication that WSACleanup() is called once too often. Most typically because somebody is ignoring a failure return code from WSAStartup(). You can protect yourself against this by calling WSAStartup() yourself. – Hans Passant Sep 20 '16 at 11:30
  • OK, I understand, for every successful WSAStartup should be one WSACleanup call. Am I right? – Tomas Kubes Sep 20 '16 at 11:53
  • 1
    @qub1n: Yes. They must be balanced. – Remy Lebeau Sep 20 '16 at 17:01

0 Answers0