hello,
I currently use lwip 1.4.1 with FreeRTOS.
I uncounter a problem when I send multiple datas.
I use teraterm to send a character. When I wait that the long string "Menu Utilisat" is written to send a character, it's ok. When I send a character without waiting, it crashs.
Is there a may to know that the send is finished ?
Thanks a lot
Marion
--------------
Here is my task :
const uint8 u8p_MainMenuTitle[SIZE_TEXT] = "Menu Utilisateur";
int g_socket_fd;
void TcpServerTask(void *pvParameters)
{
err_t err;
uint8 u8i;
int clientfd;
struct sockaddr_in client_addr;
int addrlen = sizeof(client_addr);
char buffer[100];
int nbytes;
struct sockaddr_in sa;
g_socket_fd = socket(PF_INET, SOCK_STREAM, 0);
if (g_socket_fd)
{
*MEMREG = 1;
}
else
{
memset(&sa, 0, sizeof(struct sockaddr_in));
sa.sin_family = AF_INET;
sa.sin_len = sizeof(sa);
sa.sin_addr.s_addr = htonl(INADDR_ANY);
sa.sin_port = htons(10023);
bind(g_socket_fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in));
listen(g_socket_fd, 20);
while (1) {
/* Grab new connection. */
clientfd = accept(g_socket_fd, (struct sockaddr*)&client_addr, (socklen_t *)&addrlen);
if (clientfd>0)
{
do
{
nbytes = recv(clientfd, buffer, sizeof(buffer),0);
if (nbytes > 0)
{
for (u8i = 0; u8i < 50; u8i++)
{
send(clientfd, u8p_MainMenuTitle, 10, 0);
}
}
} while (nbytes > 0);
close(clientfd);
}
}
close(g_socket_fd);
}