lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Problem with netconn_connect


From: K.J. Mansley
Subject: Re: [lwip-users] Problem with netconn_connect
Date: 25 Aug 2004 18:29:06 +0100

On Wed, 2004-08-25 at 16:46, address@hidden wrote:

> The client side code is:
>   sys_init();
>   mem_init();
>   memp_init();
>   pbuf_init();
>   
>   tcpdump_init();
>       
>   sem = sys_sem_new(0);
>   tcpip_init(tcpip_init_done, &sem);

You're missing a "sys_sem_wait(&sem); sys_sem_free(&sem);" here: it
should be the same as in the server code.

Also, what about netif_init();

And netif_set_default(netif_add(...));

>   printf("test socket!!\n");
>   if (inet_aton("192.168.0.2", (struct in_addr *)&addr) == -1)
>     {
>       printf("Error on address syntax.\n");
>     }
>   printf("try to open a socket...\n");
>   connection = netconn_new(NETCONN_TCP);
>   
>   netconn_bind(connection, &addr, 19);
>   printf("bind\n");
>   err =  netconn_connect(connection, &addr, 19);
>   if (err != ERR_OK) 
>     {
>       fprintf(stderr, "error %s\n", lwip_strerr(err));
>       netconn_delete(connection);
>       connection = NULL;
>       exit(1);
>     }
>   printf("connect done\n");
>   
>   while ((buf = netconn_recv(connection)) != NULL) {
>     printf("netconn_recv n");
>     printf("Received from port:%d", buf->fromport);
>     netbuf_data(buf, &msg, &len);
>     printf("Received data:%s", msg);
>   }






reply via email to

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