diff xsocket.h @ 261:a03df7dc98f8

Add xsocket wrappers
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Tue, 16 Jun 2015 15:09:23 +0200
parents
children ebbe0f198322
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xsocket.h	Tue Jun 16 15:09:23 2015 +0200
@@ -0,0 +1,26 @@
+#ifndef __XSOCKET_H__
+#define __XSOCKET_H__
+
+#ifdef _CVI_
+#include <ansi_c.h>
+#else
+#include <stdlib.h>
+#endif
+
+struct xsocket {
+	char *hostname;
+	int port;
+	int fd;
+};
+
+struct xsocket * xsocket(const char *hostname, const int port);
+int xconnect(struct xsocket *s);
+int xsend(struct xsocket *s, const char *data, size_t len);
+int xrecv(struct xsocket *s, char *buffer, size_t len);
+
+int msend(struct xsocket *s, const char *data, size_t len);
+int mrecv(struct xsocket *s, char *buffer, size_t len);
+
+int command(struct xsocket *s, char *frmt, ...);
+
+#endif