소스 검색

clean up example in readme

Julius Pfrommer 10 년 전
부모
커밋
dd00d919d2
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  1. 3 3
      README.md

+ 3 - 3
README.md

@@ -46,8 +46,9 @@ int main(int argc, char** argv) {
 	signal(SIGINT, stopHandler); /* catches ctrl-c */
 
     /* init the server */
+	#define PORT 16664
 	UA_String endpointUrl;
-	UA_String_copycstring("opc.tcp://192.168.56.101:16664",&endpointUrl);
+	UA_String_copyprintf("opc.tcp://127.0.0.1:%i", &endpointUrl, PORT);
 	UA_Server *server = UA_Server_new(&endpointUrl, NULL);
 
     /* add a variable node */
@@ -65,12 +66,11 @@ int main(int argc, char** argv) {
                                     &UA_NODEIDS[UA_HASCOMPONENT]);
 
     /* attach a network layer */
-	#define PORT 16664
 	NetworklayerTCP* nl = NetworklayerTCP_new(UA_ConnectionConfig_standard, PORT);
 	printf("Server started, connect to to opc.tcp://127.0.0.1:%i\n", PORT);
-	struct timeval callback_interval = {1, 0}; // 1 second
 
     /* run the server loop */
+	struct timeval callback_interval = {1, 0}; // 1 second
 	NetworkLayerTCP_run(nl, server, callback_interval, serverCallback, &running);
     
     /* clean up */