由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Linux版 - 如何terminate掉一个remote server上的tcp session?
相关主题
问个TCP有关timeout的技术问题求助,linux下的smtp
simulate connection drop by iptables?向 zher 同学道个歉
TCP三路握手的第三个ACK失踪问题一道面试题求解
泥马坑爹的tcp stack的作者ubuntu terminal: what's the easiest way to set different color for different terminals ?
screen是干啥的你们有人用googledoc么
session manager这个idea太傻B了what is this?
Python被墙了请问mpirun怎么放在后台运行?
Linux Kernel 2.6.34 版本已经正式发布在家里,连上公司VPN则没法访问公网.,给指点一下,谢谢
相关话题的讨论汇总
话题: tcp话题: server话题: session话题: fin话题: terminate
进入Linux版参与讨论
1 (共1页)
z**r
发帖数: 17771
1
【 以下文字转载自 EmergingNetworking 讨论区 】
发信人: zher (民工.铜豌豆), 信区: EmergingNetworking
标 题: 如何terminate掉一个remote server上的tcp session?
发信站: BBS 未名空间站 (Thu Mar 19 16:29:41 2009), 站内
用hping和bittwist发了RST过去到server上tcp port,没有反应。有什么办法?这种
half-open connection,已经terminated的一端,有什么办法可以send data到对方还
open的session里?
a*****i
发帖数: 4391
2

Server tcp should terminate automatically, after select failed.
But depends on how long you were asking select to wait...

【在 z**r 的大作中提到】
: 【 以下文字转载自 EmergingNetworking 讨论区 】
: 发信人: zher (民工.铜豌豆), 信区: EmergingNetworking
: 标 题: 如何terminate掉一个remote server上的tcp session?
: 发信站: BBS 未名空间站 (Thu Mar 19 16:29:41 2009), 站内
: 用hping和bittwist发了RST过去到server上tcp port,没有反应。有什么办法?这种
: half-open connection,已经terminated的一端,有什么办法可以send data到对方还
: open的session里?

z**r
发帖数: 17771
3
usually yes, but I changed the timeout to 0...

【在 a*****i 的大作中提到】
:
: Server tcp should terminate automatically, after select failed.
: But depends on how long you were asking select to wait...

f**y
发帖数: 138
4
Did you see any FIN and FIN-ACK packets from server after you sent RST?
z**r
发帖数: 17771
5
no. this is not the typical 4-way termination, so I don't think I'm supposed
to see FIN/FIN-ACK?

【在 f**y 的大作中提到】
: Did you see any FIN and FIN-ACK packets from server after you sent RST?
q**d
发帖数: 16
6
If I understand OP's question correctly, the remote site is in time_wait
state, and there is nothing client can do to make the remote TCB to CLOSED
state
however, client application can avoid it by closing the TCP connection
before server does, or, on server, change time_wait timeout.
z**r
发帖数: 17771
7
time_wait是server发了FIN,在等FIN-ACK吧?最多几分钟就timeout了,应该不是这个。
俺还是回去再读一遍TCP RFC好了,很多年不写程序了,这些细节都忘差不多了

CLOSED

【在 q**d 的大作中提到】
: If I understand OP's question correctly, the remote site is in time_wait
: state, and there is nothing client can do to make the remote TCB to CLOSED
: state
: however, client application can avoid it by closing the TCP connection
: before server does, or, on server, change time_wait timeout.

q**d
发帖数: 16
8
right. which ever make an active close would be in time_wait for timeout,
and I believ so_linger can skip the timeout. anyway check the conn state
another possiblilty, connection is broken w/o FIN received by server, and
there is no TX data to send - that is, server may not know conn is broken
for long time unless 1) keep_alive is enabled and 2)client firewall not
ignoring invalid tcp packet.
Hope it helps
f**y
发帖数: 138
9
When you construct a TCP RST packet, you may have to match the seq, ack as
well as src/dst IP and port with the existing TCP session, otherwise the
server may ignore the packet.
Regarding the time out, the linux system default TCP keepalive is 2 hours.
The application can not rely on 'select' or 'recv' to determine if the other
end of the socket is closed. It is simply too long. On the other hand, the
application can send packets periodically and catch the SIG_PIPE signal to
forcefully determine
z**r
发帖数: 17771
10
I understand what you are saying, my issue was I don't have the access to
the server, and the session was broken by accident, so yes the server didn't
know the session was broken. I know eventually the timeout will kick in, no
matter it's from the sever itself side or any layer 4 or above device in
between, but my question was how I can terminate this session...

【在 q**d 的大作中提到】
: right. which ever make an active close would be in time_wait for timeout,
: and I believ so_linger can skip the timeout. anyway check the conn state
: another possiblilty, connection is broken w/o FIN received by server, and
: there is no TX data to send - that is, server may not know conn is broken
: for long time unless 1) keep_alive is enabled and 2)client firewall not
: ignoring invalid tcp packet.
: Hope it helps

z**r
发帖数: 17771
11

I didn't know I need the seq number matching up, hmm ... good point, I'll
give it a try
other
the

【在 f**y 的大作中提到】
: When you construct a TCP RST packet, you may have to match the seq, ack as
: well as src/dst IP and port with the existing TCP session, otherwise the
: server may ignore the packet.
: Regarding the time out, the linux system default TCP keepalive is 2 hours.
: The application can not rely on 'select' or 'recv' to determine if the other
: end of the socket is closed. It is simply too long. On the other hand, the
: application can send packets periodically and catch the SIG_PIPE signal to
: forcefully determine

1 (共1页)
进入Linux版参与讨论
相关主题
在家里,连上公司VPN则没法访问公网.,给指点一下,谢谢screen是干啥的
ubuntu怎么显示启动菜单和启动过程session manager这个idea太傻B了
grub2按什么建能显示菜单Python被墙了
grub 2 so stupidLinux Kernel 2.6.34 版本已经正式发布
问个TCP有关timeout的技术问题求助,linux下的smtp
simulate connection drop by iptables?向 zher 同学道个歉
TCP三路握手的第三个ACK失踪问题一道面试题求解
泥马坑爹的tcp stack的作者ubuntu terminal: what's the easiest way to set different color for different terminals ?
相关话题的讨论汇总
话题: tcp话题: server话题: session话题: fin话题: terminate