Hello all - I thought I'd join the users group and list a couple of the
recent projects I'm working on.

Areas of interest: uIP on Winbond 78E516 (8052 type microcontroller)

I recently completed an upgrade from the 8051 Van Luyn 0.9 port, to uip 1.0 

I have a question on the best way to implement iterative (not concurrent)
server model.  I implemented a TCP server on port 1000.  I can connect from
multiple clients on this port.  I want to force the TCP server to service
only 1 client connection in series.  If a client is already connected on
1000, then I need to close the second attempted connection.  Is there any
advice on the best way to do this?  I think using uip_close() on the second
connection attempt might work.

Also I ran across an problem in recent testing with a TFTP server.  When
making a client UDP connection from the microcontroller to the well known
port number 69, the TFTPD server assigns a dynamic session port say 30000.
when the response datagrams are processed by UIP it rejects the packet since
it did not arrive from the well known port 69 in the original connection.

To fix this problem I changed the IP and port matching logic in UIP.   For
those that are interested I included this minor change below.  The code
captures the dynamic server port so subsequent client datagrams can be sent
to the dynamic port.

UIP.C LINE 1121:

  /* Demultiplex this UDP packet between the UDP "connections". */
  for(uip_udp_conn = &uip_udp_conns[0];
      uip_udp_conn < &uip_udp_conns[UIP_UDP_CONNS];
      ++uip_udp_conn) {

    /* If the local UDP port is non-zero, the connection is considered
       to be used. If so, the local port number is checked against the
       destination port number in the received packet. If the two port
       numbers match, the remote port number is checked if the
       connection is bound to a remote port. Finally, if the
       connection is bound to a remote IP address, the source IP
       address of the packet is checked. */

     // MODIFIED:  relaxes the port match to allow the remote
     // to listen on a well known port number, then assign a 
     // local port for the session. 
     // records the assigned connect port since that will the
     // port number to transmit to.

    if(uip_udp_conn->lport != 0) {
       if ((UDPBUF->destport == uip_udp_conn->lport) &&
       (uip_ipaddr_cmp(uip_udp_conn->ripaddr, all_zeroes_addr) ||
        uip_ipaddr_cmp(uip_udp_conn->ripaddr, all_ones_addr) ||
        uip_ipaddr_cmp(BUF->srcipaddr, uip_udp_conn->ripaddr))) 
        {
                // record assigned connect port
                uip_udp_conn->rport = UDPBUF->srcport;
                UIP_LOG("udp: assigned connect port");
                goto udp_found;
        }  // if IP match and lport matches
   }  // if non-zero port
  }  // for all connections
  UIP_LOG("udp: no matching connection found");
  goto drop;





Reply via email to