Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • "what is the right thing to do in a situation where the client doesn't know the type of socket to which he needs to connect?" - try what it might be. socket name, socket type, application protocol ... are needed to contact the peer like the full email address and not just parts of it are needed to send an email. Commented Jan 19, 2022 at 8:53
  • @SteffenUllrich, let's say I know server IP and socket port, now I want to connect to socket, but don't know its type. Isn't there a way to determine this data without iterating over? Commented Jan 19, 2022 at 8:59
  • "Isn't there a way to determine this data without iterating over?" - No. The same with port or IP - if you don't know these you need to guess and try. Commented Jan 19, 2022 at 9:37
  • I don't know much about BSD (my knowledge is mostly Linux Oriented)... There should usually be some way to list open sockets on a system. Eg: sockstat cyberciti.biz/tips/… I would assume this could let you discover the socket type. Commented Jan 19, 2022 at 9:46