tgetprotobyname.nim 380 B

12345678910111213141516
  1. import nativesockets
  2. import std/assertions
  3. doAssert getProtoByName("ipv6") == 41
  4. doAssert getProtoByName("tcp") == 6
  5. doAssert getProtoByName("udp") == 17
  6. doAssert getProtoByName("icmp") == 1
  7. doAssert getProtoByName("ipv6-icmp") == 58
  8. when defined(windows):
  9. doAssertRaises(OSError):
  10. discard getProtoByName("raw")
  11. doAssertRaises(OSError):
  12. discard getProtoByName("Error")