引用:感谢大家的热心。 这是昨天在面试中遇到的无法回答的问题。 面试官也马上问了backlog参数的意思,不明白!
因为没有这方面的经验-_-! 楼主在工作中一直用JAVA写代码-_-!
昨天回来,赶紧翻开unixprogramming的书,发现有以下一节。
thebacklogargumentprovidesahinttothesystemofthenumberofoutstandingconnectrequeststhatitshouldenqueueonbehalfoftheprocess.thehered
OnSolaris,thesomaxconnvalueinisignored.theparticularmaximumdependsontheimplementationofeachprotocol.fortcp,thedefaultioration
Oncethequeueisfull,thesystemwillrejectadditionalconnectrequests,sothebacklogvaluemustbechosenbasedontheeeexpectedloadofthesesesethesesets
Onceaserverhascalledlisten,thesocketusedcanreceiveconnectrequests.weusetheacceptfunctiontoretrieveaconnectrequestandconverer