# UIP (software)

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/UIP_(software)
> Markdown URL: https://mediated.wiki/source/UIP_(software).md
> Source: https://en.wikipedia.org/wiki/UIP_(software)
> Source revision: 1310696541
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Open-source implementation of the TCP/IP network protocol stack}}
{{Lowercase title}}
{{Infobox software
| name                   = uIP
| title                  = 
| logo                   = <!-- File: -->
| logo caption           = 
| screenshot             = <!-- File: -->
| caption                = 
| collapsible            = 
| author                 = 
| developer              = 
| released               = <!-- {{Start date|YYYY|MM|DD|df=yes/no}} -->
| discontinued           = 
| latest release version = {{wikidata|property|reference|P348}}
| latest release date    = {{start date and age|{{wikidata|qualifier|P348|P577}}}}
| latest preview version = 
| latest preview date    = <!-- {{Start date and age|YYYY|MM|DD|df=yes/no}} -->
| programming language   = 
| operating system       = 
| platform               = [embedded system](/source/embedded_system)s
| size                   = 
| language               = 
| genre                  = [TCP/IP](/source/TCP%2FIP) stack
| license                = BSD
}}
The '''uIP''' is an [open-source](/source/open-source_software) implementation of the [TCP/IP](/source/TCP%2FIP) network protocol stack intended for use with tiny 8- and 16-bit [microcontrollers](/source/microcontrollers). It was initially developed by [Adam Dunkels](/source/Adam_Dunkels) of the Networked Embedded Systems group at the [Swedish Institute of Computer Science](/source/Swedish_Institute_of_Computer_Science), licensed under a BSD style license, and further developed by a wide group of developers.

uIP can be very useful in [embedded system](/source/embedded_system)s because it requires very small amounts of code and RAM. It has been ported to several platforms,<ref name="maxim-app-note" /><ref name="cyan-app-note" /><ref name="olimex" /> including [DSP](/source/Digital_signal_processing) platforms.<ref name="inside-uip" />

In October 2008, [Cisco](/source/Cisco), [Atmel](/source/Atmel), and [SICS](/source/SICS) announced a fully compliant [IPv6](/source/IPv6) extension to uIP, called uIPv6.<ref name="Cisco-PR" />

==Implementation==

uIP makes many unusual design choices in order to reduce the resources it requires.  uIP's native software interface is designed for small computer systems with no operating system.  It can be called in a timed loop, and the call manages all the retries and other network behavior. The hardware driver is called after uIP is called.  uIP builds the packet, and then the driver sends it, and optionally receives a response.

It is normal for IP protocol stack software to keep many copies of different IP packets, for transmission, reception and to keep copies in case they need to be resent. uIP is economical in its use of memory because it uses only one packet buffer.  First, it uses the packet buffer in a half-duplex way, using it in turn for transmission and reception. Also, when uIP needs to retransmit a packet, it calls the application code in a way that requests for the previous data to be reproduced.

Another oddity is how uIP manages connections.  Most IP implementations have one task per connection, and the task communicates with a task in a distant computer on the other end of the connection.  In uIP, no multitasking operating system is assumed.  Connections are held in an array. On each call, uIP tries to serve a connection, making a subroutine call to application code that responds to, or sends data. The size of the connection array is a number that can be adjusted when uIP is recompiled.

uIP is fully compliant with the [RFCs](/source/Request_for_Comments) that define [TCP](/source/Transmission_Control_Protocol), [UDP](/source/User_Datagram_Protocol) and [IP](/source/Internet_Protocol).  It also implements the mandatory maintenance protocol [ICMP](/source/Internet_Control_Message_Protocol).

==Versions==
uIP 0.9<ref name="uip-0.9" /> is the version with the least dependence on operating systems, the smallest resource use, and the only version that presents a pure event loop [API](/source/API), but in its original form does not support IP version 6, only the older, more common IPv4. It may be used in [embedded system](/source/embedded_system)s with very small amounts of resources.

It was delivered with a set of examples of higher-level protocols that also run on an event loop system, including [HTTP](/source/HTTP) (a simple web server), [SMTP](/source/SMTP) (simple mail transmission protocol), [FTP](/source/FTP) (file transfer protocol), [telnet](/source/telnet) (terminal emulation), and others.  Despite the examples and its small size, uIP 0.9 can be difficult to apply because it does not use any form of socket [API](/source/API).<ref>See Dunkel's original web site, above, on the wayback machine.</ref>

uIP is widely used code with well-known weaknesses.  The design minimizes and separates 32-bit arithmetic so that it can be adjusted or optimized for 8 and 16-bit CPUs.  Also, 16-bit software timers (common on small microcontrollers) can [overflow](/source/Integer_overflow) and cause defective operation.  This can be fixed with a timer system that does not overflow (e.g. the timers count down or use [modular arithmetic](/source/modular_arithmetic)).

Another issue is that its single packet buffer can have substantial throughput problems because a PC host usually delays the "ACK" packet, waiting for more packets.  In slow, [serial port](/source/serial_port) implementations, the ack-throughput can be fixed by modifying uIP to send every packet as two half-packet fragments.  uIP systems with fast [ethernet](/source/ethernet) or [WiFi](/source/WiFi) can modify the hardware driver to send every packet twice.<ref name="inside-uip" />

Some PCs do not correctly respond to a fast uIP system on a local Ethernet, because the uIP system can start a responding packet before the PC is ready to receive it.{{Dubious|date=November 2015}}  The solution is to call the uIP system less frequently in the main loop (Windows PCs are designed for a response time of about 1 millisecond).  Typical implementations of uIP have a fixed IP address, which can make them impractical in real networks, although some have implemented [DHCP](/source/DHCP).<ref>{{usurped|1=[https://web.archive.org/web/20120409035049/http://support.code-red-tech.com/CodeRedWiki/VersionInfo See Code-Red sample code for the RDB4078 PCB, 2012]}}.</ref><ref>Dunkel provided sample code for DHCP.</ref>

Later versions of uIP, including the reference version of uIPv6, are integrated with [Contiki](/source/Contiki), an operating system that uses [coroutine](/source/coroutine)s for cooperative multitasking.  Contiki provides the multitasking needed by a simplified socket [API](/source/API), simplifying the use of uIP.  These versions may be less popular than 0.9 however.  Many examples of embedded code do not use them.<ref>Metzinger, above</ref><ref>[http://www.freertos.org/RTOS_ports.html FreeRTOS web site examples, 2013]</ref><ref>Code-Red examples, above.</ref>

==See also==
* [Internet Engineering Task Force](/source/Internet_Engineering_Task_Force)
* [List of TCP and UDP port numbers](/source/List_of_TCP_and_UDP_port_numbers)
* [lwIP](/source/lwIP) –another TCP/IP stack project (also created by Dunkels), but more fully-featured and aimed at more capable hardware

==References==
{{Reflist|refs=

<ref name="uip-0.9">{{cite web
|url=https://github.com/adamdunkels/uip/tags
|title=Tagged releases
|first=Adam |last=Dunkels
|work=uIP tagged releases on [GitHub](/source/GitHub)
|access-date=February 2, 2015
}}</ref>

<ref name="maxim-app-note">{{cite web
|url=http://www.maximintegrated.com/en/app-notes/index.mvp/id/4205
|title=APPLICATION NOTE 4205 - Using the uIP Stack to Network a MAXQ Microcontroller
|first=Zach |last=Metzinger
|work=Maxim Integrated Products, Inc.
|date=March 25, 2008
|access-date=February 2, 2015
}}</ref>

<ref name="cyan-app-note">{{cite web|url=http://www.cyantechnology.com/public/AN057uIPV1_0TCP-IPStackforeCOG1kandeCOG1X.pdf |title=AN057 – uIP V1.0 TCP/IP Stack for eCOG1k and eCOG1X, Version 1.0 |work=Cyan Technology Ltd. |date=January 28, 2008 |access-date=February 18, 2012 |url-status=dead |archive-url=https://web.archive.org/web/20120218123417/http://www.cyantechnology.com/public/AN057uIPV1_0TCP-IPStackforeCOG1kandeCOG1X.pdf |archive-date=February 18, 2012 }}</ref>

<ref name="olimex">{{cite web
|url=http://www.rowley.co.uk/msp430/uip.htm
|title=Adam Dunkel's uIP on the Olimex EasyWeb2 and LPC-E2124
|first=Paul |last=Curtis
|work=Rowley Associates Limited
|access-date=February 2, 2015
}}</ref>

<ref name="inside-uip">{{cite web
|url=http://www.drdobbs.com/inside-the-uip-stack/184405971
|title=Inside the uIP Stack
|first1=Drew |last1=Barnett
|first2=Anthony J. |last2=Massa
|work=Dr Dobbs Journal
|date=February 1, 2005
|access-date=February 2, 2015
}}</ref>

<ref name="Cisco-PR">{{cite web
|url=http://newsroom.cisco.com/dlls/2008/prod_101408e.html
|title=Cisco, Atmel and the Swedish Institute of Computer Science (SICS) Collaborate to Support a Future Where Any Device Can Be Connected to the Internet
|work=Cisco
|date=October 14, 2008
|access-date=February 2, 2015
}}</ref>

}}

==External links==
* [https://github.com/adamdunkels/uip uIP source]
* [http://code.google.com/p/avr-uip/ uIP port for AVR microcontrollers]
* [https://web.archive.org/web/20090328085541/http://www.dynalith.com/doku.php?id=incite_examples uIP-based Webserver using OpenRISC-embedded SoC]

Category:Embedded systems
Category:Free network-related software
Category:Software using the BSD license
Category:TCP implementations

---
Adapted from the Wikipedia article [UIP (software)](https://en.wikipedia.org/wiki/UIP_(software)) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/UIP_(software)?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
