X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2FIOHandler_test%2Fclient%2B%2B%2Fiotest.cpp;fp=src%2FIOHandler_test%2Fclient%2B%2B%2Fiotest.cpp;h=151ce0d8254c748f028acea789b2b6d85ff889c2;hb=db1e9413159cdfd975bf9ebcd5f43b665b13ab0b;hp=0000000000000000000000000000000000000000;hpb=70a1c9616475c6978e4fa361c4263e0916d2649e;p=IOMultiplexer.git
diff --git a/src/IOHandler_test/client++/iotest.cpp b/src/IOHandler_test/client++/iotest.cpp
new file mode 100644
index 0000000..151ce0d
--- /dev/null
+++ b/src/IOHandler_test/client++/iotest.cpp
@@ -0,0 +1,57 @@
+/* main.c - IOMultiplexer
+ * Copyright (C) 2012 Philipp Kreil (pk910)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include
+#include "../../IOHandler++/IOHandler.h"
+#include "../../IOHandler++/IOSocket.h"
+
+class IOTestSocket : public CIOSocket {
+protected:
+ virtual void connectedEvent() {
+ printf("[connect]\n");
+ this->writef("GET / HTTP/1.1\r\n");
+ this->writef("Host: test.pk910.de\r\n");
+ this->writef("\r\n");
+ };
+ virtual void notConnectedEvent(int errid) {
+ printf("[not connected]\n");
+ };
+ virtual void closedEvent(int errid) {
+ printf("[disconnect]\n");
+ };
+ virtual void acceptedEvent(CIOSocket *client) {
+ client->close();
+ };
+ virtual void dnsErrEvent(std::string *errormsg) {
+
+ };
+ virtual int recvEvent(const char *data, int len) {
+ int i;
+ for(i = 0; i < len; i++)
+ putchar(data[i]);
+ return len;
+ };
+};
+
+
+int main(int argc, char *argv[]) {
+ CIOHandler *iohandler = new CIOHandler();
+ IOTestSocket *sock = new IOTestSocket();
+ sock->connect("test.pk910.de", 443, 1, NULL);
+
+ iohandler->start();
+}