tags:

views:

147

answers:

1

In any socket API the close() method closes a connection with a FIN. If I want to abort a connection with a RST how can I do it?

+2  A: 

I am not sure about Ruby EventMachine, but if what that framework gives you is a normal Ruby TCPSocket, then you should be able to turn on SO_LINGER by doing something like this:

linger = [1,0].pack('ii')
sock.setsockopt(Socket::SO_SOCKET, Socket::SO_LINGER, linger)
sock.close
Aaron Hinni