Skip to main content

Home/ Coders/ Group items matching "Again" in title, tags, annotations or url

Group items matching
in title, tags, annotations or url

Sort By: Relevance | Date Filter: All | Bookmarks | Topics Simple Middle
ma_haijin

TCP 的那些事儿(上) 酷壳 - CoolShell.cn | 酷 壳 - CoolShell.cn - 0 views

shared by ma_haijin on 11 Aug 16 - No Cached
  • TCP的包是没有IP地址的,那是IP层上的事。但是有源端口和目标端口。
  • Sequence Number是包的序号,用来解决网络包乱序(reordering)问题。
  • Acknowledgement Number就是ACK——用于确认收到,用来解决不丢包的问题。
  • ...14 more annotations...
  • Window又叫Advertised-Window,也就是著名的滑动窗口(Sliding Window),用于解决流控的。
  • TCP Flag ,也就是包的类型,主要是用于操控TCP的状态机的。
  • 其实,网络上的传输是没有连接的,包括TCP也是一样的。而TCP所谓的“连接”,其实只不过是在通讯的双方维护一个“连接状态”,让它看上去好像有连接一样。所以,TCP的状态变换是非常重要的。
  • 这个号要作为以后的数据通信的序号,以保证应用层接收到的数据不会因为网络上的传输的问题而乱序(TCP会用这个序号来拼接数据)。
  • 关于建连接时SYN超时。试想一下,如果server端接到了clien发的SYN后回了SYN-ACK后client掉线了,server端没有收到client回来的ACK,那么,这个连接处于一个中间状态,即没成功,也没失败。于是,server端如果在一定时间内没有收到的TCP会重发SYN-ACK。在Linux下,默认重试次数为5次,重试的间隔时间从1s开始每次都翻售,5次的重试时间间隔为1s, 2s, 4s, 8s, 16s,总共31s,第5次发出后还要等32s都知道第5次也超时了,所以,总共需要 1s + 2s + 4s+ 8s+ 16s + 32s = 2^6 -1 = 63s,TCP才会把断开这个连接。
  • 请注意,请先千万别用tcp_syncookies来处理正常的大负载的连接的情况。因为,synccookies是妥协版的TCP协议,并不严谨。对于正常的请求,你应该调整三个TCP参数可供你选择,第一个是:tcp_synack_retries 可以用他来减少重试次数;第二个是:tcp_max_syn_backlog,可以增大SYN连接数;第三个是:tcp_abort_on_overflow 处理不过来干脆就直接拒绝连接了。
  • 一个ISN的周期大约是4.55个小时。因为,我们假设我们的TCP Segment在网络上的存活时间不会超过Maximum Segment Lifetime(缩写为MSL – Wikipedia语条),所以,只要MSL的值小于4.55小时,那么,我们就不会重用到ISN。
  • 为什么不直接给转成CLOSED状态呢?主要有两个原因:1)TIME_WAIT确保有足够的时间让对端收到了ACK,如果被动关闭的那方没有收到Ack,就会触发被动端重发Fin,一来一去正好2个MSL,2)有足够的时间让这个连接不会跟后面的连接混在一起(你要知道,有些自做主张的路由器会缓存IP数据包,如果连接被重用了,那么这些延迟收到的包就有可能会跟新连接混在一起)。
  • Again,使用tcp_tw_reuse和tcp_tw_recycle来解决TIME_WAIT的问题是非常非常危险的,因为这两个参数违反了TCP协议
  • 如果你的服务器是于HTTP服务器,那么设置一个HTTP的KeepAlive有多重要(浏览器会重用一个TCP连接来处理多个HTTP请求)
  • TCP要保证所有的数据包都可以到达,所以,必需要有重传机制。
  • 接收端给发送端的Ack确认只会确认最后一个连续的包,比如,发送端发了1,2,3,4,5一共五份数据,接收端收到了1,2,于是回ack 3,然后收到了4(注意此时3没收到),此时的TCP会怎么办?我们要知道,因为正如前面所说的,SeqNum和Ack是以字节数为单位,所以ack的时候,不能跳着确认,只能确认最大的连续收到的包,不然,发送端就以为之前的都收到了。
  • TCP引入了一种叫Fast Retransmit 的算法,不以时间驱动,而以数据驱动重传。也就是说,如果,包没有连续到达,就ack最后那个可能被丢了的包,如果发送方连续收到3次相同的ack,就重传。Fast Retransmit的好处是不用等timeout了再重传。
  • 注意:SACK会消费发送方的资源,试想,如果一个攻击者给数据发送方发一堆SACK的选项,这会导致发送方开始要重传甚至遍历已经发出的数据,这会消耗很多发送端的资源。
  •  
    TCP是一个巨复杂的协议,因为他要解决很多问题,而这些问题又带出了很多子问题和阴暗面。所以学习TCP本身是个比较痛苦的过程,但对于学习的过程却能让人有很多收获。关于TCP这个协议的细节,我还是推荐你去看W.Richard Stevens的《TCP/IP 详解 卷1:协议》(当然,你也可以去读一下RFC793以及后面N多的RFC)。另外,本文我会使用英文术语,这样方便你通过这些英文关键词来查找相关的技术文档。 之所以想写这篇文章,目的有三个, 一个是想锻炼一下自己是否可以用简单的篇幅把这么复杂的TCP协议描清楚的能力。 另一个是觉得现在的好多程序员基本上不会认认真真地读本书,喜欢快餐文化,所以,希望这篇快餐文章可以让你对TCP这个古典技术有所了解,并能体会到软件设计中的种种难处。并且你可以从中有一些软件设计上的收获。 最重要的希望这些基础知识可以让你搞清很多以前一些似是而非的东西,并且你能意识到基础的重要。 所以,本文不会面面俱到,只是对TCP协议、算法和原理的科普。 我本来只想写一个篇幅的文章的,但是TCP真TMD的复杂,比C++复杂多了,这30多年来,各种优化变种争论和修改。所以,写着写着就发现只有砍成两篇。 上篇中,主要向你介绍TCP协议的定义和丢包时的重传机制。 下篇中,重点介绍TCP的流迭、拥塞处理。 废话少说,首先,我们需要知道TCP在网络OSI的七层模型中的第四层--Transport层,IP在第三层--Network层,ARP在第二层--Data Link层,在第二层上的数据,我们叫Frame,在第三层上的数据叫Packet,第四层的数据叫Segment。 首先,我们需要知道,我们程序的数据首先会打到TCP的Segment中,然后TCP的Segment会打到IP的Packet中,然后再打到以太网Ethernet的Frame中
longchamppas

billiga ralph lauren kortärmad Systrarna - 0 views

But then strange feelings appear feelings for her best friend she has never had before.Then Mary appears out of nowhere. Katies grandmother the one she has never met. She seems to have forgotten wh...

billiga ralph lauren långärmad kortärmad pony polo

started by longchamppas on 27 Jul 16 no follow-up yet
EMDADUL HAQUE

Free Download - 1 views

  •  
    Android is the best choice of all kind of people in this world. If you want Free Download android apps, games, theme, wallpaper everything is free download in our site. If you want to any kind of help contact with me. Our service all time ready just for you. Again I says that 'Proceed to Download'.
sam ali

Be Easy Get more $ - 0 views

  •  
    At the weekend I sent you an email giving information about a new simple system I've discovered that helps people like you and me make money online. I can see from the "open rate" statistics that 97% of the Posts didn't get opened hence I thought I'd give the details again because of those who did read the post, the feedback has been fantastic. You may or may not be aware that I've had the joy of being able to work from home full-time since 2010 (you can find out more about me on Facebook (frazzaq69@yahoo.com) and in those 3 years I've learned how to sort the rubbish opportunities from the genuine business opportunities and I've got to say this is one of the best I have seen. WARNING! This is not a flashy presentation with fast cars and big houses - and you'll hear my kids shouting in the background but that's the point, you don't need to be professional to make money, you just need to have a system that works and follow it. For me, it's not about BIG money, it's about FREEDOM. Freedom to choose where and when I work and not be answerable to some boss who doesn't appreciate me. It's flexibility and being able to spend you time with those I love rather than working 40-50 hours a week in some office. As you can see I am not hiding behind a fake id or anything like that, I am totally genuine and down to earth sort of guy and want to help other people get the freedom that I enjoy. No boss to answer too, choose your own hours and so on. So if that appeals to you, take a look at the Page and take the free tour: http://earnearnearning.blogspot.com.au
cecilia marie

My Computer Problem Was Solved in a Few Minutes - 8 views

I had a good internet connection for the past few weeks. Then I began to observe that it was not working the way it should be compared to the past few weeks. I tried to troubleshoot it myself but, ...

computer problem

started by cecilia marie on 06 Oct 11 no follow-up yet
samonjur

Keywodrs is very important for every website. - 0 views

  •  
    Simply how much targeted traffic are you currently shedding mainly because an individual never have identified several unexpected yet potent keywords and phrases? Choosing the clear keywords and phrases to your internet pages is easy. And also obtaining connected, high-demand and also low-supply keywords and phrases which can be potent to your web site just isn't too much once you begin making use of Wordtracker. Yet think about people keywords and phrases which can be actually unexpected? Think about keywords and phrases you'll by no means consider, yet which may have the particular prospective to operate a vehicle thousands of fresh visitors to your internet site?Pleasant to be able to Wordtracker Search term Study AccountsBeing a Wordtracker client, you are going to right away acquire totally free usage of the most notable 1, 000 keywords and phrases used throughout the key engines like google : equally short-term and also long-term.And also for a few internet marketers, which is adequate.Nonetheless it just isn't adequate should you have identified the actual prospective regarding working together with one of the most searched-for or perhaps freshly growing keywords and phrases on the web.Significant web marketers and also SEARCH ENGINE MARKETING specialists which are seeking development final results consider Wordtracker's Search term Study Record alternatives: from your Top, 000, entirely for the Leading 20 thousand phrases.Just how these kinds of accounts supply development final resultsCheck our own Search term Study Accounts throughout. Try to find hugely well-known, or perhaps freshly growing phrases and words that might be utilized to make huge amounts regarding fresh targeted traffic.How can this kind of perform? You're not trying to find well-known keywords and phrases that may deliver folks inside from the "front door" of your distinct web site. You are interested in undiscovered jewels that will deliver a large amount regarding targeted traffic inside
Joel Bennett

"Your File Is In Use" Demystified - Shell Blog - 0 views

  •  
    In Vista, Windows Explorer is applying an implementation of the IFileIsInUse interface to the file it encountered.  Now the user knows which program has the file open and can close the file from that program and click the Try Again button to repeat the operation that was being performed.
Rick Fan

McCoy - MDC - 0 views

shared by Rick Fan on 11 Oct 08 - Cached
  • Once you have a key you need to add its public part to your add-on's install.rdf file. The simplest way to do this is to select the key then click the Install toolbar button. You must then locate your install.rdf for McCoy and the public part of the key will be added directly to the file. The file will be overwritten so take a backup if you need to.
  • You need to use McCoy to sign this file so that the application can verify that it really came from you. Simply select the key you originally added to the add-on's install.rdf, then click the "Sign" toolbar button, select your update.rdf file and the data in it will be signed. It's important to note that if you change any information in the update file then it must be signed again.
David Corking

Twitter XSS Strikes Again | SophosLabs blog | April 18 2009 - 0 views

  •  
    "It is still a good idea to run Firefox and NoScript to help protect yourself from all kinds of Javascript attacks." Not more of this?!
Matteo Spreafico

Classical Inheritance in JavaScript - 0 views

  • function ZParenizor2(value) { var that = new Parenizor(value); that.toString = function () { if (this.getValue()) { return this.uber('toString'); } return "-0-" }; return that; }
    • Matteo Spreafico
       
      This constructors lies, wondeful!
  • Again, we augment Function. We make an instance of the parent class and use it as the new prototype. We also correct the constructor field, and we add the uber method to the prototype as well.
  • This adds a public method to the Function.prototype, so all functions get it by Class Augmentation. It takes a name and a function, and adds them to a function's prototype object.
  • ...3 more annotations...
  • To make the examples above work, I wrote four sugar methods. First, the method method, which adds an instance method to a class. Function.prototype.method = function (name, func) { this.prototype[name] = func; return this; };
  • JavaScript can be used like a classical language, but it also has a level of expressiveness which is quite unique. We have looked at Classical Inheritance, Swiss Inheritance, Parasitic Inheritance, Class Augmentation, and Object Augmentation. This large set of code reuse patterns comes from a language which is considered smaller and simpler than Java.
  • I have been writing JavaScript for 8 years now, and I have never once found need to use an uber function. The super idea is fairly important in the classical pattern, but it appears to be unnecessary in the prototypal and functional patterns. I now see my early attempts to support the classical model in JavaScript as a mistake.
Rajan Datta

IDEOne - Online Compiler and Debugging tool - 8 views

  •  
    Choose language, paste code and input data (optionally), choose whether your code ought to be executed and whether it ought to be private (i.e. not listed in recent pastes) and click submit button. Then watch your code being executed, share it with your team or friends, or run it again with new input to debug.
  •  
    Ideone is an online compiler and debugging tool which allows you to compile source code and execute it online in more than 60 programming languages.
Sanny Y

Online Computer Tech Support Service that Understands Urgency - 2 views

My business cannot live without the support of computers. My products are all recorded in a database system and so is my payroll system. Plus, I constantly surf the web to check on my clients onlin...

online computer tech support

started by Sanny Y on 14 Jun 11 no follow-up yet
shalali stokes

They Fix Slow Computers Fast - 1 views

I called Fix Slow Computer Online to help me fix slow computers. I own an internet cafe and I have noticed that my computers are running slow. That is why I right away sought out a solution to my p...

Development fix slow computer fast

started by shalali stokes on 11 Aug 11 no follow-up yet
Rem PC

The Best Remote PC Support I Ever Had - 1 views

The Remote PC Support Now excellent remote PC support services are the best. They have skilled computer tech professionals who can fix your PC while you wait or just go back to work or just simply...

remote PC support

started by Rem PC on 29 Sep 11 no follow-up yet
Rem PC

The Best Remote PC Support I Ever Had - 1 views

The Remote PC Support Now excellent remote PC support services are the best. They have skilled computer tech professionals who can fix your PC while you wait or just go back to work or just simply...

remote PC support

started by Rem PC on 12 Sep 11 no follow-up yet
Computer Support US

Reliable Computer Support Professional - 2 views

Lately, my computer is always freezing but I cannot point out why it constantly crashes. I already bought my PC to our local computer technician but I see no progress. Until one day, I was too busy...

computer support

started by Computer Support US on 06 Oct 11 no follow-up yet
shalani mujer

Quality Tech Support - 1 views

I am an online writer and I consider my computer as my best friend. I have to make sure that my computer is in good condition always. Unfortnately, I have been experiencing computer problems lately...

tech support

started by shalani mujer on 06 Oct 11 no follow-up yet
liza cainz

Helpful and Polite Computer Tech Support Service - 1 views

I thank the competent team of Help Gurus for being able to respond to my call after my computer slowed down last week. As I have suspected, the computer tech support technician found out that it wa...

support service Desktop computer technical services PC tech

started by liza cainz on 06 Apr 11 no follow-up yet
seth kutcher

Excellent Computer Assistance Tech Services Provider - 1 views

My sister loves to download games on my computer without even checking if they contained any viruses. So one day while she was playing the game she downloaded, my PC broke down. So I called Compute...

computer assistance

started by seth kutcher on 13 Jul 11 no follow-up yet
john sega

Reliable Desktop Computer Support Services - 1 views

My friend is having an issue with her desktop computer so I told her to ask the help of DesktopComputerSupports. They offer accurate and reliable desktop computer support services! So she called D...

desktop computer support

started by john sega on 11 Jul 11 no follow-up yet
‹ Previous 21 - 40 of 55 Next ›
Showing 20 items per page