Jump to content
  • Advertisement
Sign in to follow this  
spraff

AF_UNIX sockets

This topic is 3584 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi there. This is the first time I've tried to use Unix sockets. My code to create the server daemon is roughly this:
int socket_id = socket (AF_UNIX, SOCK_STREAM, MY_PORT);

If MY_PORT is 0, this works fine. "ss -lx" shows that the subsequent bind worked. If MY_PORT is some fixed value, say 12321, socket() fails with errno==93, which isn't a defined error. What's going on? I'm running Ubuntu 8.04.

Share this post


Link to post
Share on other sites
Advertisement
Oh right. Well thanks for pointing that out. Any chance you could point me to an example of binding a unix socket to a port? And what are legal values of the protocol paramater?

Share this post


Link to post
Share on other sites
You might try checking out the documentation for functions before asking questions on a message board. For a linux box, if you want to find information for a given function, you could try the man page first. In this case try typing "man socket" at the command line. And after that you might want to try "man bind".

Share this post


Link to post
Share on other sites
Comparing the IP socket data structures, there is no port for unix sockets. If unix sockets are referred to by file name only, why does "ss -lx" list port numbers?

Share this post


Link to post
Share on other sites
Sorry for posting what seems like an uninformed question, SiCrane, but I have been reading sockts documentation for a couple of hours. It's almost entirely geared to IP sockets, so I'm having a hard time finding the Unix Socket interpretation -- I blame the API, the arguments are overloaded, it's pretty shoddy design. I came here hoping someone with hands-on experience could comment.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!