what 0 indicates in following line? what are other flags i can use?
server = socket(AF_UNIX, SOCK_STREAM, 0)
From the man pages of socket:
int socket(int domain, int type, int protocol);
The protocol specifies a particular protocol to be used with the socket. Normally only a single protocol exists to support a particular socket type within a given protocol family, in which case protocol can be speci‐ fied as 0. However, it is possible that many protocols may exist, in which case a particular protocol must be specified in this manner. The protocol number to use is specific to the “communication domain” in which commu‐ nication is to take place; see protocols(5). See getprotoent(3) on how to map protocol name strings to proto‐ col numbers.