I did everything on this manual bind(2) - Linux manual pageCode:#include <stdio.h> #include <sys/socket.h> #include <sys/types.h> #include <errno.h> #include <sys/un.h> #include <stdlib.h> #include <string.h> int main() { int sock = socket(AF_LOCAL, SOCK_STREAM, 0); if(sock==-1) perror(">"); struct sockaddr_un my_addr; memset(&my_addr, 0, sizeof(struct sockaddr_un)); my_addr.sun_family=AF_UNIX; strncpy(my_addr.sun_path, "/tmp", sizeof(my_addr.sun_path) - 1); if( (bind(sock, (struct sockaddr *)&my_addr, sizeof(struct sockaddr_un))) == -1) perror(">"); }
But the manual is bad because it does not show how to assign a socket to the address I need! What to do?