We are porting FreeRTOS on Pxa303 board, we want to establish ethernet communication between 2 pxa303 boards. We are using FreeRTOS+UDP(FreeRTOSV7.4.1\FreeRTOS-Plus\Source\FreeRTOS-Plus-UDP) for this purpose, twoechoclients.c(FreeRTOSV7.4.1\FreeRTOS-Plus\Demo\Common\FreeRTOS_Plus_UDP_Demos\EchoClients\) as a client applicaion, as mentioned at http://www.freertos.org/FreeRTOS-Plus/FreeRTOS_Plus_UDP/Embedded_Ethernet_Examples/Common_Echo_Clients.shtml, website suggests desktop computer to use as a server, but we want another pxa303 board to be used as a server. Can any one guide us with how to program a server application for Pxa303 board?
FreeRTOS+UDP uses a standard (ish) sockets interface, so the procedure is as per using any other Berkeley sockets IP stack:
1) Call FreeRTOS_socket() to create a socket - it will be created with a receive block time of portMAX_DELAY.
2) Call FreeRTOS_bind() to bind the socket to the echo port (port 7 by default).
3) Call FreeRTOS_recvfrom() on the socket. If configINCLUDE_vTaskSuspend is set to 1 the call will only return once data has been received.
4) Call FreeRTOS_sendto() to send the received data back from whence it came.
5) Go back to step 3 to wait for more data.
It would look something like this (I have not tried running this code! It is for example only)
static void prvEchoServer( void *pvParameters )
struct freertos_sockaddr xAddress;
/* Make sure array is large enough and that it does not overflow the
task stack. Make it static if necessary. */
int8_t cBuffer[ 25 ];
uint32_t xAddressLength = sizeof( xAddress );
/* Remove compiler warning about unused parameters. */
( void ) pvParameters;
for( ;; )
/* Create a socket. */
xSocket = FreeRTOS_socket( FREERTOS_AF_INET,
/* Bind the the standard echo server port number. */
xAddress.sin_port = FreeRTOS_htons( echoECHO_PORT );
FreeRTOS_bind( xSocket, &xAddress, sizeof( xAddress ) );
/* Send a number of echo requests. */
for( ;; )
/* Wait for data to arrive on the echo port. */
lBytes = FreeRTOS_recvfrom( xSocket, cBuffer, sizeof( cBuffer ),
0, &xAddress, &xAddressLength );
/* Send the received data back from the originating address. */
FreeRTOS_sendto( xSocket, cBuffer, lBytes, 0,
&xAddress, xAddressLength );
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.