2011-03-20 19:18:19 +01:00
|
|
|
/****************************************************************************
|
2021-06-16 09:22:16 +02:00
|
|
|
* apps/examples/udp/udp_target1.c
|
2011-03-20 19:18:19 +01:00
|
|
|
*
|
2021-06-15 09:09:58 +02:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2011-03-20 19:18:19 +01:00
|
|
|
*
|
2021-06-15 09:09:58 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2011-03-20 19:18:19 +01:00
|
|
|
*
|
2021-06-15 09:09:58 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2011-03-20 19:18:19 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
2015-01-22 22:30:23 +01:00
|
|
|
#include "config.h"
|
2017-06-19 17:46:40 +02:00
|
|
|
#include "udp.h"
|
2015-01-22 22:30:23 +01:00
|
|
|
|
2011-03-20 19:18:19 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2017-06-19 19:03:10 +02:00
|
|
|
* udp1_main
|
2011-03-20 19:18:19 +01:00
|
|
|
****************************************************************************/
|
|
|
|
|
2014-09-06 17:23:23 +02:00
|
|
|
int main(int argc, FAR char *argv[])
|
2011-03-20 19:18:19 +01:00
|
|
|
{
|
2017-06-19 21:29:58 +02:00
|
|
|
/* Parse any command line options */
|
|
|
|
|
2017-06-25 17:15:27 +02:00
|
|
|
udp_cmdline(argc, argv);
|
2017-06-19 21:29:58 +02:00
|
|
|
|
2017-06-19 17:46:40 +02:00
|
|
|
#ifdef CONFIG_EXAMPLES_UDP_NETINIT
|
|
|
|
/* Initialize the network */
|
2015-02-03 15:01:55 +01:00
|
|
|
|
2020-01-02 13:09:50 +01:00
|
|
|
udp_netinit();
|
2017-06-19 17:46:40 +02:00
|
|
|
#endif
|
2017-05-19 17:37:17 +02:00
|
|
|
|
2017-06-19 17:46:40 +02:00
|
|
|
/* Run the server or client, depending upon how we are configured */
|
2017-05-19 17:37:17 +02:00
|
|
|
|
2017-06-19 19:03:10 +02:00
|
|
|
#ifdef CONFIG_EXAMPLES_UDP_SERVER1
|
2017-06-25 17:15:27 +02:00
|
|
|
udp_server();
|
2011-03-20 19:18:19 +01:00
|
|
|
#else
|
2017-06-25 17:15:27 +02:00
|
|
|
udp_client();
|
2011-03-20 19:18:19 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|