java - UDP or TCP for Android Audio Stream -


my ultimate goal here stream user's voice input android device on desktop application.

for android device, running java based android application. desktop application, i'm considering writing java applet accept stream.

these benefits , drawbacks of tcp , udp explained wikipedia

transmission control protocol connection-oriented protocol, means requires handshaking set end-to-end communications. once connection set up, user data may sent bi-directionally on connection.

reliable – tcp manages message acknowledgment, retransmission , timeout. multiple attempts deliver message made. if gets lost along way, server re-request lost part. in tcp, there's either no missing data, or, in case of multiple timeouts, connection dropped. ordered – if 2 messages sent on connection in sequence, first message reach receiving application first. when data segments arrive in wrong order, tcp buffers delay out-of-order data until data can re-ordered , delivered application. heavyweight – tcp requires 3 packets set socket connection, before user data can sent. tcp handles reliability , congestion control. streaming – data read byte stream, no distinguishing indications transmitted signal message (segment) boundaries. user datagram protocol simpler message-based connectionless protocol. connectionless protocols not set dedicated end-to-end connection. communication achieved transmitting information in 1 direction source destination without verifying readiness or state of receiver.

unreliable – when udp message sent, cannot known if reach destination; lost along way. there no concept of acknowledgment, retransmission, or timeout. not ordered – if 2 messages sent same recipient, order in arrive cannot predicted. lightweight – there no ordering of messages, no tracking connections, etc. small transport layer designed on top of ip. datagrams – packets sent individually , checked integrity if arrive. packets have definite boundaries honored upon receipt, meaning read operation @ receiver socket yield entire message sent. no congestion control – udp not avoid congestion. congestion control measures must implemented @ application level. broadcasts - being connectionless, udp can broadcast - sent packets can addressed receivable devices on subnet.

i user's voice stream uninterrupted , steady when android transmitting desktop application.

beyond considering benefits , drawbacks of 2 different technologies wikipedia lists, else should aware of when choosing technology?

which better choice udp or tcp?

in opinion, rely on project's specification. lost of signal acceptable or not. udp extremely faster tcp suitable stream user's voice input. looks traditional telephone call, sometime hear "noise" call still enough use. moreover, using tcp bring significant delay , udp born streaming.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -