lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] lwIP and xil_printf


From: Louis Filasky
Subject: [lwip-users] lwIP and xil_printf
Date: Tue, 3 Jul 2007 22:59:05 +0200

Hi,

I have encountered several problems and I don't know if it's due to lwIP but I never encountered any problems whenever I used the function xil_printf.

At some locations in my code, if I use this function, the server is behaving in a weird way. I'm using OPB Uartlite and whenever I try to display the content of a
variable, it crashes the server or my echo function is not responding at all. If I do a text only xil_printf, everything works fine.

#include "config.h"   // DEFAULT_PORT
#include "global.h"   // server_accept()
#include "lwip/tcp.h" // tcp_new(), tcp_bind(), tcp_listen(), tcp_accept()
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
 
#include "lwip/debug.h"
#include "lwip/stats.h"
#include "xparameters.h"

err_t server_accept(void *arg, struct tcp_pcb *pcb, err_t err)
{
  struct connection_state *cs;
 
  /* Allocate memory for the structure that holds the state of the
     connection. */
  cs = mem_malloc(sizeof(struct connection_state));

  if(cs == NULL) {
     xil_printf("could not malloc memory for server_state\r\n");
    return ERR_MEM;
  }
 
  /* Initialize the structure. */
  cs->data = "">  cs->left = 0;

  /* Tell TCP that this is the structure we wish to be passed for our
     callbacks. */
  tcp_arg(pcb, cs);

  /* Tell TCP that we wish to be informed of incoming data by a call
     to the http_recv() function. */
  tcp_recv(pcb, server_recv);
  tcp_err(pcb, server_err);
  tcp_poll(pcb, server_poll, 1);

  xil_printf("Connection established with client %s on port %d.\r\n", getRemoteHostAddress(pcb->remote_ip), (int)(pcb->local_port));
  return ERR_OK;
}

The getRemoteHostAddress is char*. Thanks for your help,

Antoine.



Besoin d'un e-mail ? Créez gratuitement un compte Windows Live Hotmail et bénéficiez d'un filtre antiphishing gratuit ! Windows Live Hotmail
reply via email to

[Prev in Thread] Current Thread [Next in Thread]