2

One normally closes a socket by calling close(). But what if you want to reset / abort the connection (RST packet)? How do you send it from userland?

XTF
  • 1,071
  • 1
  • 11
  • 30

1 Answers1

3

If I recall, you set the SO_LINGER option.

struct linger l;
l.l_onoff = 1;
l.l_linger = 0;

setsockopt(sock, SOL_SOCKET, SO_LINGER, &l, sizeof(l));
selbie
  • 91,215
  • 14
  • 97
  • 163