This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Multiple incoming connections with TCPNet

Hi,

There's something I don't understand reading the tcpnet user guide .
I want to code an simple FTP server that can manage at least 2 connections.

Si it seems I have to create a listening socket like the example from the user guide :

   init_TcpNet ();
   tcp_soc = tcp_get_socket (TCP_TYPE_SERVER, 0, 30, tcp_callback);
   if (tcp_soc != 0) {
      /* Start listening on TCP port 80 */
      tcp_listen (tcp_soc, 80);

But then , how to manage several connections ?

In lwpip stack for example , you create a listening socket associated with a callback fonction.
When a client is connecting , the callback is called with a pointer to a new socket created by the stack to manage the new incoming connection .

In tcpnet the callback fonction is like this :

U16 tcp_callback (U8 soc, U8 event, U8 *ptr, U16 par) {

Does the 'soc' parameter is the new socket to use for transmission in the socket ?

thanks in advance.

0