summaryrefslogtreecommitdiff
path: root/libmiav/aa_socket.h
diff options
context:
space:
mode:
authordeva <deva>2008-03-17 09:10:42 +0000
committerdeva <deva>2008-03-17 09:10:42 +0000
commit2f10a73cbbe4333e2a41e87a94eda7fb3d442dc5 (patch)
treecc023927be890bb4880d6c97ddaf055041c512ea /libmiav/aa_socket.h
parent6ae128fc80dd8a32ec6f062c7767ced32e9ba495 (diff)
Major code changes... FFMPEG introduced. Project splitup into subfolders.
Diffstat (limited to 'libmiav/aa_socket.h')
-rw-r--r--libmiav/aa_socket.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/libmiav/aa_socket.h b/libmiav/aa_socket.h
new file mode 100644
index 0000000..0d02723
--- /dev/null
+++ b/libmiav/aa_socket.h
@@ -0,0 +1,42 @@
+#ifndef __SOCKET_H__
+#define __SOCKET_H__
+
+#include <string>
+
+#include <netinet/in.h>
+//#include <sys/socket.h>
+
+
+/**
+ * Exceptions
+ */
+struct Network_error {
+ Network_error(char *event, char *err) {
+ error = std::string(err) + " - in " + std::string(event);
+ }
+ std::string error;
+};
+
+class AASocket {
+public:
+ AASocket();
+ ~AASocket();
+
+ void listen(unsigned short port);
+ void connect(char *ip, unsigned short port);
+
+ void send(char* buf, unsigned int buf_size);
+ int receive(char* buf, unsigned int buf_size);
+
+ void send_string(std::string buf);
+ std::string receive_string();
+
+ void force_close();
+
+private:
+ struct sockaddr_in socketaddr;
+ int socket;
+ int bind_socket; // Tmp socket for listen.
+};
+
+#endif/*__SOCKET_H__*/