Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Bugs when building on Windows (uri_facade_win.cpp,socket_channel.cpp AND tcp_server.cpp) #388

Open
HILMR opened this issue Nov 3, 2021 · 3 comments

Comments

@HILMR
Copy link

HILMR commented Nov 3, 2021

  1. Up to now, the master branch still does not merge the modifications described in issue Definition doesn't match declaration in uri_facade_win.cpp/uri_facade.h #311 and Bug fixes for Windows and the OPC UA server #312
  2. There are still errors caused by the different socket interface between Windows and Linux
  • void OpcUa::SocketChannel::Stop()
    {
    close(Socket);
    }

    void OpcUa::SocketChannel::Stop()
    {
      closesocket(Socket); //API For Windows
      //close(Socket); //API For Linux
    }
  • #ifdef _WIN32
    #include <windows.h>
    #endif

    #ifdef _WIN32
    #include <WinSock2.h> // "SD_BOTH" declared in this header file
    #include <windows.h>
    #endif
  • virtual void Stop()
    {
    if (ServerThread)
    {
    LOG_INFO(Logger, "shutting down opc ua binary server");
    Stopped = true;
    shutdown(Socket, SHUT_RDWR);
    ServerThread->Join();
    ServerThread.reset();
    }
    }

      virtual void Stop()
      {
        if (ServerThread)
          {
            LOG_INFO(Logger, "shutting down opc ua binary server");
            Stopped = true;
            shutdown(Socket, SD_BOTH); //API For Windows
            //shutdown(Socket, SHUT_RDWR); //API For Linux
            ServerThread->Join();
            ServerThread.reset();
          }
      }

Previously, the python version of this project is very easy to use, but due to some requirements changes, I have to develop the C + + version on windows. However, it is found that the support of this project for windows is not so friendly. I hope the author can further optimize it. Thank you :)

@AVerutin
Copy link

  1. Up to now, the master branch still does not merge the modifications described in issue Definition doesn't match declaration in uri_facade_win.cpp/uri_facade.h #311 and Bug fixes for Windows and the OPC UA server #312
  2. There are still errors caused by the different socket interface between Windows and Linux
  • void OpcUa::SocketChannel::Stop()
    {
    close(Socket);
    }

    void OpcUa::SocketChannel::Stop()
    {
      closesocket(Socket); //API For Windows
      //close(Socket); //API For Linux
    }
  • #ifdef _WIN32
    #include <windows.h>
    #endif

    #ifdef _WIN32
    #include <WinSock2.h> // "SD_BOTH" declared in this header file
    #include <windows.h>
    #endif
  • virtual void Stop()
    {
    if (ServerThread)
    {
    LOG_INFO(Logger, "shutting down opc ua binary server");
    Stopped = true;
    shutdown(Socket, SHUT_RDWR);
    ServerThread->Join();
    ServerThread.reset();
    }
    }

      virtual void Stop()
      {
        if (ServerThread)
          {
            LOG_INFO(Logger, "shutting down opc ua binary server");
            Stopped = true;
            shutdown(Socket, SD_BOTH); //API For Windows
            //shutdown(Socket, SHUT_RDWR); //API For Linux
            ServerThread->Join();
            ServerThread.reset();
          }
      }

Previously, the python version of this project is very easy to use, but due to some requirements changes, I have to develop the C + + version on windows. However, it is found that the support of this project for windows is not so friendly. I hope the author can further optimize it. Thank you :)

Hi. Did you find anything instead this library?

@guojing555
Copy link

guojing555 commented Mar 15, 2022 via email

@AVerutin
Copy link

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants