I have two small doubts regarding BSD socket APIs on linux
1. Is is possible to send a reset on a running connection or connection
attempt **from the application **. I understand stack can do it.
2. When a program crashes or forcefully killed what happens to it open
connections and it it is server to listening socket.
thanks
Ittium
RST tells the peer that something it sent was not read by the local
application. (The RST sent in response to a SYN on a port where nobody's
listening is a special case of that, in which the local application is
nonexistent.)
Since the kernel knows whether the RST condition applies, there is no need
for userspace to be allowed to request the sending of a RST packet. The
kernel sends them in the correct circumstances already. If you want to send
incorrect packets, that's what raw sockets are for.
>
>>
>> >
>> >> 2. When a program crashes or forcefully killed what happens to it open
>> >> connections and it it is server to listening socket.
>> >
>> > The connections should be closed.
>>
>> Please take in to consideration, that process is either crashed or
>> killed by sending signal 9.Will the server port and connection be closed
>> immediately or operating system will do cleanup later on. Whether it is
>> four way close (considering TCP) or connection abort.
>
>I'm not sure if POSIX specifies it, but I think most implementations do
>a normal close immediately.
If there's unread data in the receive queue when the socket is closed, it
should generate a RST. Otherwise, it shouldn't.
--
Alan Curry