FANDOM


netconn_accept

TCP-connections only

Warning: Change of interface


Interface for lwIP v1.4.0

err_t netconn_accept ( struct netconn * aNetConn, struct netconn ** aNewConn);

Blocking function to accept connections from a client. When a connection is established, a new netconn structure is allocated for further use.

Interface for lwIP <= v1.3.2

struct netconn * netconn_accept ( struct netconn * aNetConn );


Prior to a call to this function, netconn_listen() must be called.

Example (vor v1.4.0)

#define TNetConn struct netconn *
TNetConn xNetConn = netconn_new ( NETCONN_TCP ); // new netconn without callback


// bind to a port, any IP addre and then listen on that port
netconn_bind   ( xNetConn, NULL, cTcpPort );
netconn_listen ( xNetConn );

// task routine, loop forever
while ( true )           
{
   TNetConn xNewConn;
   Int8 xErr = netconn_accept ( xNetConn, &xNewConn );

   if ( xErr != ERR_OK )
   {
      continue;
   }

    // process connection
    NetConnServeClient ( xNewConn );
    netconn_delete     ( xNewConn );
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.