lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] fnConnected not invoked


From: martinh
Subject: [lwip-users] fnConnected not invoked
Date: Mon, 1 Dec 2014 10:07:48 -0700 (MST)

Hi
I am using TI's Starterware package with BeagleBoneBlack and need to
transfer big data packages using TCP.
Now the listener is working fine (I am using the Hercules setup utility to
check): Data is received and I also can send messages back from within the
listener function.

But I have to send data periodically from within the mainloop.
For some reason the 'Connected' function never is invoked.
Mostlikely it has something to do with the client on the remote Pc - it must
be there to accept the connection.
To run tcp_connect(), the pcb->state must be CLOSED, but for the listener
pcb it is LISTEN. Hence tcp_connect() is rejected.


This the initialisation code when I have an addional tcp_pcb just for
sending data. In this case Hercules on the remote pc has an additional TCP
client window opened. But I don't know if that is sufficient to accept a
connection:

//*********************************************************************
// Fkt.:        SesEnet_InitTx()
//          Verbindung initialisieren f. Versenden von Header u. Daten
// ein:         IP-Adr. ist bekannt (Se.dwIp)
//*********************************************************************
void SesEnet_InitTx(DWORD PortSrc) {
err_t err;

        pt_tcp_pcb_tx = tcp_new();
        tcp_bind(pt_tcp_pcb_tx, IPADDR_ANY, PORTSES_SRC_TX); // port is 9998

        //pcb = tcp_listen(pcb);

        tcp_arg(pt_tcp_pcb_tx, pt_tcp_pcb_tx); 
                //  Specifies the program specific state that should be passed 
to all
                //  other callback functions. The "pcb" argument is the current 
TCP
                //  connection control block, and the "arg" argument is the 
argument
                //  that will be passed to the callbacks.

        tcp_accept(pt_tcp_pcb_tx, TxListen_accept); // connection has been
connected to another host

        //--- connect -------------------------------------------------------
        Se.dwIp = 0xF273A8C0;   // destination IP address
        err = tcp_connect(      
                pt_tcp_pcb_tx,
                (ip_addr_t *) &Se.dwIp,
                PORTSES_DEST_TX,                // Port is 9998
                (tcp_connected_fn) Connected);

}


//**********************************************************************
// Fkt.:  TxListen_accept * A new incoming connection has been accepted.

//**********************************************************************
err_t TxListen_accept(void *arg, struct tcp_pcb *pcb, err_t err) {
        LWIP_UNUSED_ARG(err);

        /* Decrease the listen backlog counter */
        //tcp_accepted(((struct tcp_pcb_listen* )arg));

        tcp_setprio(pcb, SES_TCP_PRIO);

        /* Set up the various callback functions */
        //tcp_recv(pcb, CmdListen_recv);                // Callback-Fkt. bei 
Datenempfang
        tcp_err(pcb, Err_Tx);           // NULL - keine Callback-Fkt. bei 
fatalem
Fehler

        tcp_poll(pcb, NULL, SES_POLL_INTERVAL);  // keine Fkt. periodisch 
aufrufen

        tcp_sent(pcb, SentTx); 

        return ERR_OK;

Can anybody tell me if there is anything wrong with the initialization?
How would one typically check such a data transfer from the remote
computer's point of view?
As there is no listener function for pt_tcp_pcb_tx, could tcp_accept() do
any harm?

Would it be possible to use the same tcp_pcb for listening and sending data
(but then how to run tcp_connect() with a pcb that is not closed)?

Every comment is very much appreciated!!!!!
I have already spent a lot of time on that issue but simply can't find a
solution.

Thank you.

Martin H.



--
View this message in context: 
http://lwip.100.n7.nabble.com/fnConnected-not-invoked-tp23566.html
Sent from the lwip-users mailing list archive at Nabble.com.



reply via email to

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