ua_architecture_functions.c 944 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
  2. * See http://creativecommons.org/publicdomain/zero/1.0/ for more information.
  3. *
  4. * Copyright 2018 (c) Jose Cabral, fortiss GmbH
  5. */
  6. #ifdef UA_ARCHITECTURE_WIN32
  7. #include "ua_types.h"
  8. unsigned int UA_socket_set_blocking(UA_SOCKET sockfd){
  9. u_long iMode = 0;
  10. if(ioctlsocket(sockfd, FIONBIO, &iMode) != NO_ERROR)
  11. return UA_STATUSCODE_BADINTERNALERROR;
  12. return UA_STATUSCODE_GOOD;;
  13. }
  14. unsigned int UA_socket_set_nonblocking(UA_SOCKET sockfd){
  15. u_long iMode = 1;
  16. if(ioctlsocket(sockfd, FIONBIO, &iMode) != NO_ERROR)
  17. return UA_STATUSCODE_BADINTERNALERROR;
  18. return UA_STATUSCODE_GOOD;;
  19. }
  20. void UA_initialize_architecture_network(void){
  21. WSADATA wsaData;
  22. WORD wVersionRequested = MAKEWORD(2, 2);
  23. WSAStartup(wVersionRequested, &wsaData);
  24. }
  25. void UA_deinitialize_architecture_network(void){
  26. WSACleanup();
  27. }
  28. #endif /* UA_ARCHITECTURE_WIN32 */