原题:
tcp/ip通信建立的过程怎样?
解答:
tcp协议是面向连接的,两端主机需要同步双方的初始序号。同步需要双方都发送自己的初始序号,并且接收双方的确认(ack)信息;同时接收对方的初始序号,并且发送确认的ack。这个过程就是三次握手(three-way handshake)。
a->b syn:我的初始序号是x,ack是0,设置syn位,未设置ack位。
b->a ack:你的序号是x+1,我的初始序号是y,设置syn位和ack位。
a->b ack:你的序号是y+1,我的序号是x+1,设置ack位,未设置syn位
下一篇:面试系列5以单词为最小单位翻转字符串-改进版-
原题:
以单词为最小单位翻转字符串
write the function string reversestringwordbyword(string input) that reverses
a string word by word. for instance,
reversestringwordbyword('the house is blue') --> 'blue is house the'
reversestringwordbyword('zed is dead') --> 'dead is zed'
reversestringwordbyword('all-in-one') --> 'all-in-one'
面试系列4种的实现,比较费空间,因为多申请了一段空...[
查看详情]