[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] Checking whether the client is connected to the Server
From: |
Kieran Mansley |
Subject: |
RE: [lwip-users] Checking whether the client is connected to the Server |
Date: |
Tue, 31 Aug 2010 11:28:39 +0100 |
On Tue, 2010-08-31 at 10:21 +0000, Teckinal Greek wrote:
>
>
>
> ______________________________________________________________________
> Hi,
> yesterday i forgot to attach the screen shot of how i configured this
> Software platform for my project, now I am resending it with
> the attachment. Hope that explains or else let me know! In the mean
> time I have switched over to lwIP RAW API and ported the code. Now
> what i can see is that the value of err = 0 in the below statement
>
>
> err = tcp_connect(pcb, &ServAddr, 7777, client_connected);
>
>
> and at the same time in the conditional statement if(err == ERR_OK)
> is satisfied that means I got connected to my server.
You said earlier that you were getting an ERR_RTE when trying to
connect. Are you now saying that you don't get this error when trying
to connect and tcp_connect is returning ERR_OK? If you're still seeing
a routing error at connection time it would be useful to see the source
to your netif_ethernet_open() function
> But the problem arises with writing to the server with this block
>
>
> static err_t client_connected(void *arg, struct tcp_pcb *pcb, err_t
> err)
> {
> char string[] = "Hello!";
> LWIP_UNUSED_ARG(arg);
>
>
> if(err != ERR_OK)
> printf("\n client connected(): err argument not set to ERR_OK, but
> the value is %d\n", err);
> else
> {
> printf("\n client connected \n");
> tcp_sent(pcb, client_sent);
> tcp_write(pcb, string, sizeof(string), 0);
> }
> return err;
> }
>
>
> where I have asked the client to sending the string "Hello!" to the
> server. If it is sending to the server how can i find out that it is
> sending the data.
Look at the return value of tcp_write() and wait for your client_sent
function to be called.
Kieran