This is strictly in the context of Unix Datagram Sockets: family = AF_UNIX/AF_LOCAL type = SOCK_DGRAM
Does the following look correct for a scenario where a client sends message to server ? Server send to client not required as of now.
Listening/Server socket:
1.1. Create socket using
socket()
1.2.
bind()
to a file path1.3.
recv()
orrecvfrom()
orrecvmsg()
orread()
which'll be blocking by default unless specified viafcntl()
.Client socket:
2.1. Create socket using
socket()
2.2.
bind()
to the file path in 1.2. This throws EADDRINUSE that address already in use. Ifconnect()
is used instead then it results in EPERM operation not permitted.2.3.
sendto()
orsendmsg()
orwrite()
connect()
internally dobind()
? If not then what difference will it make if at 1.2 we do aconnect()
instead ofbind()
?