1

I have the following code that is returning an error number of 22. I can't find out anywhere what 22 refers to, can someone point out where I might find out?

  if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
                 (char *)&arg, sizeof(arg)) < 0) {
    log.debug("unable to setsockopt TCP_NODELAY: %d", errorNumber());
    return false;
  }
fredley
  • 32,953
  • 42
  • 145
  • 236

2 Answers2

2

Its defined in errno.h or somewhere close to it. I would guess it to be EINVAL, but its really implementation dependent. You should check your return values with error code defines, not numeric values.

littleadv
  • 20,100
  • 2
  • 36
  • 50
1

It's system specific.

Use e.g. strerror(3), strerror_r(3) or perror(3) to see error description.

Tomek Szpakowicz
  • 14,063
  • 3
  • 33
  • 55