[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Consecutive calls to sendto() and recvfrom() functions
From: |
pekez |
Subject: |
[lwip-users] Consecutive calls to sendto() and recvfrom() functions |
Date: |
Mon, 24 Oct 2016 13:44:27 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
Hi guys!
I've been trying to implement UDP server application on my custom ZYNQ
board. I am using lwip141 1.5 with FreeRTOS.
This is a simple UDP server example I am trying to implement:
while ( TRUE )
{
for ( i = 0; i < 4; i++)
{
printf("waiting for message...\r\n");
bytes_received = recvfrom(socket_value, buffer,
MAX_UDP_PACKET_SIZE, 0, (struct sockaddr*) &client_addr, &addr_size);
printf("message received: %s\n", buffer);
}
buffer[0] = 'e';
for ( i = 0; i < 4; i++)
{
temp = buffer[0] + i;
sendto(socket_value, &temp, 1, 0, (struct sockaddr*)
&client_addr, addr_size);
}
}
Note: before this while loop I have only calls to socket and bind, and
of course, part of code that sets sockaddr_in struct for server. So,
it's really simple app.
On the client side, of course, it is vice versa, I have 4 sendto() calls
and than 4 recvfrom() calls. I have tried these applications on PC (with
windows sockets), both server and client were run at the same PC, and
that works in an expected way. However, when I run my server application
on ZYNQ board it behaves quite randomly. For example, server receives
only the last message, while the first three are not received/detected.
Can anyone help me with problem, I would be really grateful? If there is
any other information I need to give, please tell me, I am not sure
whether I forgot to mention something.
Thank you
- [lwip-users] Consecutive calls to sendto() and recvfrom() functions,
pekez <=