Home:ALL Converter>How to configure the path for the UDP on the UNIX domain socket?

How to configure the path for the UDP on the UNIX domain socket?

Ask Time:2011-10-19T02:58:00         Author:Jason

Json Formatter

I am new to socket programming. I'm tring to establish an UNIX domain socket with DATAGRAM. I look up the information about the configuration of sun_path in struct sockaddr_un for a while, seems like there are not enough sources to help me.

I created 3 files, unix_socket.c (provides an interface for socket connection), udp_server.c and udp_client.c, all are located in the directory "/home/Socket". When I set the sun_path as "home/Socket", the server side always generates an error "Address already in use". I also tried using "localSocket" and "echo_socket", but the client side always generates an error "No such file or directory".

I have no idea what's going on. Could anybody help me fix it? Really appreciate.

Thank you very much

Author:Jason,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/7812227/how-to-configure-the-path-for-the-udp-on-the-unix-domain-socket
yy