﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-Calvin's Tech Space-随笔分类-Network</title><link>http://www.blogjava.net/lihao336/category/47043.html</link><description>成于坚忍，毁于浮躁</description><language>zh-cn</language><lastBuildDate>Fri, 02 Sep 2011 01:58:48 GMT</lastBuildDate><pubDate>Fri, 02 Sep 2011 01:58:48 GMT</pubDate><ttl>60</ttl><item><title>Streaming vs. progressive download: Understanding the difference</title><link>http://www.blogjava.net/lihao336/archive/2011/09/01/357749.html</link><dc:creator>calvin</dc:creator><author>calvin</author><pubDate>Thu, 01 Sep 2011 08:35:00 GMT</pubDate><guid>http://www.blogjava.net/lihao336/archive/2011/09/01/357749.html</guid><wfw:comment>http://www.blogjava.net/lihao336/comments/357749.html</wfw:comment><comments>http://www.blogjava.net/lihao336/archive/2011/09/01/357749.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lihao336/comments/commentRss/357749.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lihao336/services/trackbacks/357749.html</trackback:ping><description><![CDATA[
		<div class="posttitle">
				<h2>Streaming vs. progressive download: Understanding the difference</h2>
				<p class="post-info">January 12, 2009 by <a href="http://blog.mydeo.com/author/ksobey/" title="Posts by Kent">Kent</a></p>
		</div>
		<p class="MsoNormal" style="margin:0 0 10pt;">
				<strong>
						<span style="text-decoration:underline;">
								<span style="font-size:small;">
										<span style="font-family:Calibri;">Streaming vs. progressive download: Understanding the difference</span>
								</span>
						</span>
				</strong>
		</p>
		<p class="MsoNormal" style="margin:0 0 10pt;">
				<span style="font-size:small;font-family:Calibri;">One
 of the most frequently asked questions about delivering video online is
 – “What’s the difference between streaming video and progressive 
download?” As a user clicking a video link on a website, you will not 
often know which delivery method is being used, unless you do some 
poking around. Although the end result may look the same to the end 
user, streaming and progressive download are very different delivery 
methods, each with their own strengths and weaknesses. Here we will take
 a look at the two delivery methods and help you to decide which will 
work best for you.</span>
		</p>
		<p class="MsoNormal" style="margin:0 0 10pt;">
				<span style="font-size:small;font-family:Calibri;">
				</span>
		</p>
		<p class="MsoNormal" style="margin:0 0 10pt;">
				<strong>
						<span style="text-decoration:underline;">
								<span style="font-size:small;">
										<span style="font-family:Calibri;">Delivering a file via HTTP:</span>
								</span>
						</span>
				</strong>
		</p>
		<p class="MsoNormal" style="margin:0 0 10pt;">
				<span style="font-size:small;font-family:Calibri;">Delivery
 of a file over HTTP is normally referred to as ‘progressive download’ 
or ‘http streaming’. In reality, it is not streaming at all but a very 
simple bulk download of a video file to the end user’s computer.<span></span>A
 temporary copy of the video file is then stored on the local computer 
so that the viewer can watch the file over and over without having to 
download the file each time.</span>
		</p>
		<p class="MsoNormal" style="margin:0 0 10pt;">
				<span style="font-size:small;font-family:Calibri;">Let’s
 assume you have a video file encoded at 500kbps. The server delivering 
the file does not know or care that your video file is encoded at 
500kbps; it simply pushes data to the host machine as quickly as it can.
 This can sometimes give the illusion that the file is being streamed 
because playback can start as soon as enough of the file is available on
 the local machine. This obviously restricts the users from skipping to 
parts of the file that have not yet been downloaded.</span>
		</p>
		<p class="MsoNormal" style="margin:0 0 10pt;">
				<span style="font-size:small;font-family:Calibri;">If
 the bandwidth available to the machine downloading the file is smaller 
than the encoded bit-rate there may be a wait before the file will start
 to play. For example, on a 56kbps dial-up modem, trying to play a file 
that is encoded at 500kbps you may have to wait a fairly long time 
before enough of the file has been downloaded for it to start playing. 
On a 500kbps internet connect, or faster, playback should start almost 
immediately and the file should download faster than it will play, 
meaning that playback will not have to stop because not enough data has 
been downloaded.</span>
		</p>
		<p class="MsoNormal" style="margin:0 0 10pt;">
				<span style="font-size:small;">
						<span style="font-family:Calibri;">HTTP(Hypertext
 transport protocol) operates over TCP(Transport control protocol) which
 controls the actual transport of the packets over the network. TCP is 
optimized for guarantee of delivery, regardless of file format or size. 
If a packet is skipped during the transfer of a file, it will request a 
resend of that packet. Resend requests take time and bandwidth and could
 increase the load on the server.<span> TCP is not designed for 
efficient real time delivery or careful bandwidth control, but for 
accurate and reliable delivery of every bit.</span></span>
				</span>
		</p>
		<p class="MsoNormal" style="margin:0 0 10pt;">
				<span>
						<span style="font-size:small;font-family:Calibri;">
						</span>
				</span>
		</p>
		<p class="MsoNormal" style="margin:0 0 10pt;">
				<strong>
						<span style="text-decoration:underline;">
								<span style="font-size:small;">
										<span style="font-family:Calibri;">Delivering from a streaming server:</span>
								</span>
						</span>
				</strong>
		</p>
		<p class="MsoNormal" style="margin:0 0 10pt;">
				<span style="font-size:small;font-family:Calibri;">Effectively,
 a streaming server is a piece of software which deals with video 
requests. Unlike a standard web server delivering a video file over HTTP
 (progressive download), a streaming server opens a conversation with 
the local machine. There are two sides to this conversation, one is for 
transferring the video and the other is for control messages between the
 media player and the server. These control messages include commands 
such as ‘play’, ‘pause’, ‘stop’ and ‘seek’.</span>
		</p>
		<p class="MsoNormal" style="margin:0 0 10pt;">
				<span style="font-size:small;font-family:Calibri;">If
 you have a 56kbps connection, you will not be able to receive a stream 
encoded at 500kbps; you will have to settle for a lower quality video 
encoded for 56kbps connections. Streaming does however have many 
advantages.</span>
		</p>
		<p class="MsoListParagraphCxSpFirst" style="text-indent:-18pt;margin:0 0 0 36pt;">
				<span>
						<span>
								<span style="font-size:small;font-family:Calibri;">1.</span>
								<span style="font:7pt &quot;">
								</span>
						</span>
				</span>
				<span style="font-size:small;font-family:Calibri;">You
 can begin video playback at any point of the video, or skip through the
 video as you see fit. This is very convenient for users.</span>
		</p>
		<p class="MsoListParagraphCxSpMiddle" style="text-indent:-18pt;margin:0 0 0 36pt;">
				<span>
						<span>
								<span style="font-size:small;font-family:Calibri;">2.</span>
								<span style="font:7pt &quot;">
								</span>
						</span>
				</span>
				<span style="font-size:small;font-family:Calibri;">It
 makes a lot more efficient use of bandwidth as you are only using 
bandwidth for part of the video that are actually watched as opposed to 
HTTP delivery where the whole file gets delivered.</span>
		</p>
		<p class="MsoListParagraphCxSpLast" style="text-indent:-18pt;margin:0 0 10pt 36pt;">
				<span>
						<span>
								<span style="font-size:small;font-family:Calibri;">3.</span>
								<span style="font:7pt &quot;">
								</span>
						</span>
				</span>
				<span style="font-size:small;font-family:Calibri;">The
 video file is not stored on the viewer’s computer – the video data is 
played and then discarded by the media player. This lets you maintain 
more control over your content.</span>
		</p>
		<p class="MsoNormal" style="margin:0 0 10pt;">
				<span style="font-size:small;font-family:Calibri;">Streaming
 servers use a specific set of protocols to deliver streams, such as 
RTSP(Real time streaming protocol), RTMP(Real time messaging protocol)<span></span>and
 MMS(Microsoft media services). These protocols are all more suited to 
delivering video streams because they are more focussed with continuous 
delivery than they are with 100% accuracy. Unlike TCP, they do not send 
resend requests for missing packets but instead continue with the rest 
of the video file. The idea is that it is better to have a momentary 
glitch in audio or video than for the playback to stop altogether and 
wait for the missing data.</span>
		</p>
		<p class="MsoNormal" style="margin:0 0 10pt;">
				<strong>
						<span style="text-decoration:underline;">
								<span style="font-size:small;">
										<span style="font-family:Calibri;">Conclusion:</span>
								</span>
						</span>
				</strong>
		</p>
		<p class="MsoNormal" style="margin: 0pt 0pt 10pt;">
				<span style="font-size: small; font-family: Calibri;">In
 conclusion, both streaming and progressive download have their own 
benefits and limitations. If you are trying to reach viewers with slower
 connections and need the quality to be high, progressive download would
 be your best option. On the other hand, if you know that your viewers 
will all have a fast enough connection to view your stream, you might 
save on bandwidth by streaming the video. Without knowing who your video
 will be served to, progressive download will always be a safer option 
because no matter what connection they have, they will be able to view 
your video. For live streaming, a streaming server has to be used. This 
cannot be done over HTTP.</span>
		</p>
		<p class="MsoNormal" style="margin:0 0 10pt;">
				<span style="font-size:small;font-family:Calibri;">Original posted at http://blog.mydeo.com/2009/01/12/streaming-vs-progressive-download-understanding-the-difference/<br /></span>
		</p>
<img src ="http://www.blogjava.net/lihao336/aggbug/357749.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lihao336/" target="_blank">calvin</a> 2011-09-01 16:35 <a href="http://www.blogjava.net/lihao336/archive/2011/09/01/357749.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>linux下ping命令DSCP位和DF位设置</title><link>http://www.blogjava.net/lihao336/archive/2010/11/22/338698.html</link><dc:creator>calvin</dc:creator><author>calvin</author><pubDate>Mon, 22 Nov 2010 07:24:00 GMT</pubDate><guid>http://www.blogjava.net/lihao336/archive/2010/11/22/338698.html</guid><wfw:comment>http://www.blogjava.net/lihao336/comments/338698.html</wfw:comment><comments>http://www.blogjava.net/lihao336/archive/2010/11/22/338698.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lihao336/comments/commentRss/338698.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lihao336/services/trackbacks/338698.html</trackback:ping><description><![CDATA[<br />
<strong>设置dscp</strong><br />
ping -Q 0x02 www.google.com<br />
<br />
<img alt="" src="http://www.blogjava.net/images/blogjava_net/lihao336/Screenshot-1.png" height="550" width="808" /><br />
<br />
如图，通过-Q参数设置的值影响到Differentiated Service Filed,共八位<br />
详细参见linux ping man page对-Q选项的解释。<br />
<br />
<strong>设置DF</strong><br />
将DF位置位：<br />
ping -M do www.google.com<br />
取消设置DF位：<br />
ping -M dont www.google.com<br />
默认情况下，DF位处于置位状态，即Don't Fragment<br />
<br />
参见<br />
<a href="http://yurisk.info/2009/09/01/ping-setting-dont-fragment-bit-in-linuxfreebsdsolarisciscojuniper/">http://yurisk.info/2009/09/01/ping-setting-dont-fragment-bit-in-linuxfreebsdsolarisciscojuniper/</a><br />
<img src ="http://www.blogjava.net/lihao336/aggbug/338698.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lihao336/" target="_blank">calvin</a> 2010-11-22 15:24 <a href="http://www.blogjava.net/lihao336/archive/2010/11/22/338698.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]MTU与MSS</title><link>http://www.blogjava.net/lihao336/archive/2010/11/22/338696.html</link><dc:creator>calvin</dc:creator><author>calvin</author><pubDate>Mon, 22 Nov 2010 07:10:00 GMT</pubDate><guid>http://www.blogjava.net/lihao336/archive/2010/11/22/338696.html</guid><wfw:comment>http://www.blogjava.net/lihao336/comments/338696.html</wfw:comment><comments>http://www.blogjava.net/lihao336/archive/2010/11/22/338696.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lihao336/comments/commentRss/338696.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lihao336/services/trackbacks/338696.html</trackback:ping><description><![CDATA[MTU与MSS值到底设置为多少?<br />
MTU: Maxitum Transmission Unit 最大传输单元<br />
<br />
MSS: Maxitum Segment Size 最大分段大小<br />
<br />
PPPoE: PPP Over Ethernet（在以太网上承载PPP协议）<br />
<br />
[分析过程]<br />
先说说这MTU最大传输单元，这个最大传输单元实际上和链路层协议有着密切的关系，让我们先仔细回忆一下EthernetII帧的结构DMAC+SMAC+Type+Data+CRC由于以太网传输电气方面的限制，每个以太网帧都有最小的大小64bytes最大不能超过1518bytes，对于小于或者大于这个限制的以太网帧我们都可以视之为错误的数据帧，一般的以太网转发设备会丢弃这些数据帧。（注：小于64Bytes的数据帧一般是由于以太网冲突产生的&#8220;碎片&#8221;或者线路干扰或者坏的以太网接口产生的，对于大于1518Bytes的数据帧我们一般把它叫做Giant帧，这种一般是由于线路干扰或者坏的以太网口产生）。<br />
<br />
由于以太网EthernetII最大的数据帧是1518Bytes这样，刨去以太网帧的帧头（DMAC目的MAC地址48bit=6Bytes+SMAC源MAC地址48bit=6Bytes+Type域2bytes）14Bytes和帧尾CRC校验部分4Bytes（这个部门有时候大家也把它叫做FCS），那么剩下承载上层协议的地方也就是Data域最大就只能有1500Bytes这个值我们就把它称之为MTU。这个就是网络层协议非常关心的地方，因为网络层协议比如IP协议会根据这个值来决定是否把上层传下来的数据进行分片。就好比一个盒子没法装下一大块面包，我们需要把面包切成片，装在多个盒子里面一样的道理。当两台远程PC互联的时候，它们的数据需要穿过很多的路由器和各种各样的网络媒介才能到达对端，网络中不同媒介的MTU各不相同，就好比一长段的水管，由不同粗细的水管组成（MTU不同 ）通过这段水管最大水量就要由中间最细的水管决定。<br />
<br />
对于网络层的上层协议而言（我们以TCP/IP协议族为例）它们对水管粗细不在意它们认为这个是网络层的事情。网络层IP协议会检查每个从上层协议下来的数据包的大小，并根据本机MTU的大小决定是否作&#8220;分片&#8221;处理。分片最大的坏处就是降低了传输性能，本来一次可以搞定的事情，分成多次搞定，所以在网络层更高一层（就是传输层）的实现中往往会对此加以注意！有些高层因为某些原因就会要求我这个面包不能切片，我要完整地面包，所以会在IP数据包包头里面加上一个标签：DF（Donot Fragment）。这样当这个IP数据包在一大段网络（水管里面）传输的时候，如果遇到MTU小于IP数据包的情况，转发设备就会根据要求丢弃这个数据包。然后返回一个错误信息给发送者。这样往往会造成某些通讯上的问题，不过幸运的是大部分网络链路都是MTU1500或者大于1500。<br />
<br />
对于UDP协议而言，这个协议本身是无连接的协议，对数据包的到达顺序以及是否正确到达不甚关心，所以一般UDP应用对分片没有特殊要求。<br />
<br />
对于TCP协议而言就不一样了，这个协议是面向连接的协议，对于TCP协议而言它非常在意数据包的到达顺序以及是否传输中有错误发生。所以有些TCP应用对分片有要求---不能分片（DF）。<br />
<br />
花开两朵，各表一枝，说完MTU的故事我们该讲讲今天的第二个猪脚---PPPoE所谓PPPoE就是在以太网上面跑PPP协议，有人奇怪了，PPP协议和Ethernet不都是链路层协议吗？怎么一个链路层跑到另外一个链路层上面去了，难道升级成网络层协议了不成。其实这是个误区：就是某层协议只能承载更上一层协议。为什么会产生这种奇怪的需求呢？这是因为随着宽带接入（这种宽带接入一般为Cable Modem或者xDSL或者以太网的接入）由于以太网缺乏认证计费机制而传统运营商是通过PPP协议来对拨号等接入服务进行认证计费的，所以就出了这么一个怪胎：PPPoE。<br />
<br />
PPPoE带来了好处，也带来了一些坏处，比如：二次封装耗费资源，降低了传输效能等等，这些坏处俺也不多说了，最大的坏处就是PPPoE导致MTU变小了以太网的MTU是1500，再减去PPP的包头包尾的开销（8Bytes），就变成1492。如果两台主机之间的某段网络使用了PPPoE那么就会导致某些不能分片的应用无法通讯。这个时候就需要我们调整一下主机的MTU，通过降低主机的MTU，这样我们就能够顺利地进行通讯了。<br />
<br />
当然对于TCP应用而言还有另外的解决方案。马上请出今天第三位猪脚：MSS。MSS最大传输大小的缩写，是TCP协议里面的一个概念。MSS就是TCP数据包每次能够传输的最大数据分段。为了达到最佳的传输效能TCP协议在建立连接的时候通常要协商双方的MSS值，这个值TCP协议在实现的时候往往用MTU值代替（需要减去IP数据包包头的大小20Bytes和TCP数据段的包头20Bytes）所以往往MSS为1460。通讯双方会根据双方提供的MSS值得最小值确定为这次连接的最大MSS值。<br />
<br />
介绍完这三位猪脚,我们回过头来看前言里面的那个问题，我们试想一下，如果我们在中间路由器上把每次TCP连接的最大MSS进行调整这样使得通过PPPoE链路的最大MSS值加上数据包头包尾不会超过PPPoE的MTU大小1492这样就不会造成无法通讯的问题,所以上面的问题可以通过ip tcp adjust-mss 1452来解决,当然问题也可以通过修改PC机的MTU来解决。<br />
<br />
不改MSS会如何？有可能会出现部分网站打不开，例如陶宝，在线银行什么的。或者开网页慢，都可能和MSS有关系的。<br />
修改办法（2927版本）<br />
IP==&gt;&gt;Firwwall==&gt;&gt;Mangle==&gt;&gt;点+号==&gt;&gt;<br />
General页<br />
Chain:forward<br />
Protocol:tcp<br />
<br />
Advanced页<br />
Tcpflags选SYN<br />
<br />
Action页<br />
action:Change mss<br />
new tcpmss:1472<br />
<br />
关于MSS数值的多少，以及取值办法~<br />
<br />
在Windows环境下，ping 目标网站 -f -l 1500&nbsp; 然后看能否PING通，如果PING不通，就以4为单位往下减，目标网站可以是<br />
你想访问，但访问不了，也可以是其他一些网站，这个要求不多。。<br />
比如我PING 百度<br />
ping www.baidu.com -f -l 1500<br />
得到以下提示：<br />
<br />
C:\&gt;ping www.baidu.com -f -l 1500<br />
<br />
Pinging www.a.shifen.com [202.108.22.5] with 1500 bytes of data:<br />
<br />
Packet needs to be fragmented but DF set.<br />
Packet needs to be fragmented but DF set.<br />
Packet needs to be fragmented but DF set.<br />
Packet needs to be fragmented but DF set.<br />
<br />
Ping statistics for 202.108.22.5:<br />
&nbsp;&nbsp;&nbsp; Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),<br />
<br />
这就说明，1500这个MSS数值不可取，需要往下了换，那么就以4位单位往下减，减到通为止，就是1500-4=？？？自己去算了。我这里是1472才通的，所以我改的就是1472<br />
<br />
C:\&gt;ping www.baidu.com -f -l 1472<br />
<br />
Pinging www.a.shifen.com [202.108.22.5] with 1472 bytes of data:<br />
<br />
Reply from 202.108.22.5: bytes=1472 time=29ms TTL=53<br />
Reply from 202.108.22.5: bytes=1472 time=29ms TTL=53<br />
Reply from 202.108.22.5: bytes=1472 time=29ms TTL=53<br />
Reply from 202.108.22.5: bytes=1472 time=29ms TTL=53<br />
<br />
Ping statistics for 202.108.22.5:<br />
&nbsp;&nbsp;&nbsp; Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),<br />
Approximate round trip times in milli-seconds:<br />
&nbsp;&nbsp;&nbsp; Minimum = 29ms, Maximum = 29ms, Average = 29ms<br />
<br />
这就是通了，基于给地网络状况不同，所以MSS也不仅相同，大家要自己测试，多做试验。 <br />
<br />
转自 <a href="http://www.clxp.net.cn/article.asp?id=253">http://www.clxp.net.cn/article.asp?id=253</a><br />
<img src ="http://www.blogjava.net/lihao336/aggbug/338696.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lihao336/" target="_blank">calvin</a> 2010-11-22 15:10 <a href="http://www.blogjava.net/lihao336/archive/2010/11/22/338696.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>[转]Ajax缓存解决办法</title><link>http://www.blogjava.net/lihao336/archive/2010/11/15/338122.html</link><dc:creator>calvin</dc:creator><author>calvin</author><pubDate>Mon, 15 Nov 2010 10:40:00 GMT</pubDate><guid>http://www.blogjava.net/lihao336/archive/2010/11/15/338122.html</guid><wfw:comment>http://www.blogjava.net/lihao336/comments/338122.html</wfw:comment><comments>http://www.blogjava.net/lihao336/archive/2010/11/15/338122.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lihao336/comments/commentRss/338122.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lihao336/services/trackbacks/338122.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.blogjava.net/lihao336/archive/2010/11/15/338122.html'>阅读全文</a><img src ="http://www.blogjava.net/lihao336/aggbug/338122.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lihao336/" target="_blank">calvin</a> 2010-11-15 18:40 <a href="http://www.blogjava.net/lihao336/archive/2010/11/15/338122.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>