4 #include <sys/socket.h>
7 #define SERVER "/tmp/serversocket"
15 struct sockaddr_un name
;
19 /* Remove the filename first, it's ok if the call fails */
22 /* Make the socket, then loop endlessly. */
23 sock
= make_named_socket (SERVER
);
26 /* Wait for a datagram. */
28 nbytes
= recvfrom (sock
, message
, MAXMSG
, 0,
29 (struct sockaddr
*) & name
, &size
);
32 perror ("recfrom (server)");
36 /* Give a diagnostic message. */
37 fprintf (stderr
, "Server: got message: %s\n", message
);
39 /* Bounce the message back to the sender. */
40 nbytes
= sendto (sock
, message
, nbytes
, 0,
41 (struct sockaddr
*) & name
, size
);
44 perror ("sendto (server)");