2 * Copyright (c) 2018 Cisco and/or its affiliates.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
17 #include <sys/socket.h>
18 #include <netinet/in.h>
20 #include <arpa/inet.h>
22 #include <vcl/vppcom.h>
27 struct sockaddr_in server_address;
31 rv = vppcom_app_create ("test_vcl_listener_client");
34 client_session = vppcom_session_create(VPPCOM_PROTO_TCP, 0);
36 memset(&server_address, 0, sizeof(server_address));
37 server_address.sin_family = AF_INET;
38 server_address.sin_port = htons(9995);
39 server_address.sin_addr.s_addr = inet_addr("127.0.0.1");
41 endpt.is_ip4 = (server_address.sin_family == AF_INET);
42 endpt.ip = (uint8_t *) & server_address.sin_addr;
43 endpt.port = (uint16_t) server_address.sin_port;
46 vppcom_session_connect(client_session, &endpt);
48 /*---- Read the message from the server into the buffer ----*/
49 vppcom_session_read (client_session, buffer, 1024);
51 /*---- Print the received message ----*/
52 printf("Data received: %s",buffer);
54 printf("Press ENTER key to Continue\n");