Saturday, August 24, 2013

Transport Layer Protocols-UDP

Transport Layer Protocols-UDP

User Datagram Protocol (UDP)
UDP is a standard protocol with STD number 6. UDP is described by RFC 768 – User Datagram Protocol. Its status is recommended, but in practice every TCP/IP implementation that is not used exclusively for routing will include UDP.
UDP is basically an application interface to IP. It adds no reliability, flow-control, or error recovery to IP. It simply serves as a multiplexer/demultiplexer for sending and receiving datagrams, using ports to 
direct the datagrams.UDP provides a mechanism for one application to send a datagram to another. The UDP layer can be regarded as being extremely thin and consequently has low overheads, but it requires the application to take responsibility for error recovery and so on. Applications sending datagrams to a host need to identify a target that is more specific than the IP address, since datagrams are normally directed to 
certain processes and not to the system as a whole. UDP provides this by using ports.


UDP datagram format

Each UDP datagram is sent within a single IP datagram. Although, the IP datagram may be fragmented during transmission, the receiving IP implementation will reassemble it before presenting it to the UDP layer. All IP implementations are required to accept datagrams of 576 bytes, which means that, allowing for maximum-size IP header of 60 bytes, a UDP datagram of 516 bytes is acceptable to all implementations.

• Source Port: Indicates the port of the sending process. It is the port to which replies should be addressed.
• Destination Port: Specifies the port of the destination process on the destination host.
• Length: The length (in bytes) of this user datagram, including the header.
• Checksum: An optional 16-bit one's complement of the one's complement sum of a pseudo-IP header, the UDP header, and the UDP data. The pseudo-IP header contains the source and destination IP addresses, the protocol, and the UDP length:

UDP application programming interface
The application interface offered by UDP is described in RFC 768. It provides for:
• The creation of new receive ports.
• The receive operation that returns the data bytes and an indication of source port and source IP address.
• The send operation that has, as parameters, the data, source, and destination ports and addresses.
The way this interface should be implemented is left to the discretion of each vendor.



Upload UIImage as base64 String

Upload UIImage as Base64 String (Upload UIImage as string) //Select Pic From Camera or Gallery       @objc func btnPro...