opcuaServer.c 881 B

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. ============================================================================
  3. Name : opcuaServer.c
  4. Author :
  5. Version :
  6. Copyright : Your copyright notice
  7. Description :
  8. ============================================================================
  9. */
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include "networklayer.h"
  13. UA_Int32 serverCallback(void * arg) {
  14. char *name = (char *) arg;
  15. printf("%s does whatever servers do\n",name);
  16. return UA_SUCCESS;
  17. }
  18. // necessary for the linker
  19. int pthread_create(pthread_t* newthread, const pthread_attr_t* attr, void *(*start) (void *), void * arg) {
  20. perror("this routine should be never called in single-threaded mode\n");
  21. exit(1);
  22. }
  23. int main(int argc, char** argv) {
  24. NL_data* nl = NL_init(&NL_Description_TcpBinary,16664);
  25. struct timeval tv = {2, 0}; // 2 seconds
  26. NL_msgLoop(nl, &tv,serverCallback,argv[0]);
  27. }