Skip to content

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

Description

@HILMR
  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 :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions