sendto The sendto function sends data to a specific destination.int sendto( SOCKET s, const char FAR *buf, int len, int flags, const struct sockaddr FAR *to, int tolen ); Parameters s [in] Descriptor identifying a (possibly connected) socket. buf [in] Buffer containing the data to be transmitted. len [in] Length of the data in buf. flags [in] Indicator specifying the way in which the call is made. to [in] Optional pointer to the address of the target socket. tolen [in] Size of the address in to. Return Values If no error occurs, sendto returns the total number of bytes sent, which can be less than the number indicated by len. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.
mtu 的概念属于哪层?不要将莫须有的东西 当作真实来看 先试验下 其实不会遇到你说的问题的这些都在ip分组的时候处理了。
也就是讲UDP socket来发送数据不能保证一定到达接收端,也不能保证按发送的先后顺序到达(也许后发的还先到达).MTU,应用程序员不用关心,因为在IP层,数据包过大,发送端的IP层会自动分片.然后到了接收端,在送给上层协议时自动还原成分片前的包.结论:你要用UDP来发送视频包,应当允许接在路由的过程中丢失一些包.
也就是讲UDP socket来发送数据不能保证一定到达接收端,也不能保证按发送的先后顺序到达(也许后发的还先到达)
---------------------------------------------------------------------------------------------------------
对,TCP协议才是有序的包
谢谢你,难道RTP协议解决了时序问题吗?如果我捕捉到一帧大小为70K的数据,RTP协议也不能帮我传输吧?好像不能传输这么大的数据
数据包到达的时序问题我可以解决,丢包也可以解决,但是我是把一帧数据作为一个UDP数据包发过去的,另外在前面加了一个包头,可是某些时候一帧数据过大(比如说70K),UDP能发送吗?
The sendto function sends data to a specific destination.int sendto(
SOCKET s,
const char FAR *buf,
int len,
int flags,
const struct sockaddr FAR *to,
int tolen
);
Parameters
s
[in] Descriptor identifying a (possibly connected) socket.
buf
[in] Buffer containing the data to be transmitted.
len
[in] Length of the data in buf.
flags
[in] Indicator specifying the way in which the call is made.
to
[in] Optional pointer to the address of the target socket.
tolen
[in] Size of the address in to.
Return Values
If no error occurs, sendto returns the total number of bytes sent, which can be less than the number indicated by len. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.
我是将UDP改造成了TUDP来进行类似TCP的传输的
成熟的第三方RUDP库清单
UDT(Last Version UDTm 4.2)
Enat (Last Version 1.2)
Raknet