foo-wm

(Archived) Experimental Zooming IPC-based WM
git clone http://milesalan.com/git/foo-wm
Log | Files | Refs | Mirror | README | LICENSE

commit 29499aec5b2be7930091bc054e70e25ce8b3c083
parent 9e05818197ff44532b5d1e248a60a601e0d71d5a
Author: = <miles.sandlar@gmail.com>
Date:   Tue, 31 Jul 2012 17:47:34 -0400

Added client.c

Diffstat:
Asrc/client.c | 28++++++++++++++++++++++++++++
1 file changed, 28 insertions(+), 0 deletions(-)

diff --git a/src/client.c b/src/client.c @@ -0,0 +1,28 @@ +#include <stdio.h> +#include <stdlib.h> +#include <sys/socket.h> +#include <sys/un.h> +#include <unistd.h> + +int main(int argc, char **argv) { + int socketFd; + struct sockaddr_un socketAddress; + char response[256]; + + /* Initialize the sockaddr_un struct */ + socketAddress.sun_family = AF_UNIX; + strcpy(socketAddress.sun_path, argv[1]); + + /* Setup the socket, Connect, and Send the send CL Arg */ + socketFd = socket(AF_UNIX, SOCK_STREAM, 0); + connect(socketFd, (struct sockaddr *)&socketAddress, sizeof(socketAddress)); + send(socketFd, argv[2], strlen(argv[2]), 0); + + /* Check if we recieved a response */ + if ((recv(socketFd, response, sizeof(response), 0)) > 0) + printf("%s\n", response); + + /* Close and return */ + close(socketFd); + return 0; +}