hi every body could you please help me . I write java code for sending string msg between client and server using udp socket . but I want to to send real time voice so could you please give some notes to do it
3 回答
I can point you a little of the way, you probably would want to use the Real-time Transport Protocol (RTP), which is more or less the standard for sending audio or video real time over the net. However the implementation is not straight forward, and you should use a helper library like jlibrtp for the implementation. There is also a RTP packetizer in Java Media Framework (JMF), but you don't wanna go there....
UDP 没有服务质量保证,因此在发送数据包时,您需要在数据中添加某种订单号,以确定如何将数据重新组合在一起。例如,您可以从服务器按顺序发送 3 个数据报包,但客户端可能会以不同的顺序(2、1、3)获取它们。或者它可能根本没有得到其中之一,在这种情况下,您要么希望它重新发送(怀疑),要么只是忽略它并在某个超时时继续前进。
Look into using Real Time Protocol RFC3550 (http://en.wikipedia.org/wiki/Real-time_Transport_Protocol) as the transport over UDP. RTCP as the control over TCP.