summaryrefslogtreecommitdiff
path: root/server/src/tcpsocket.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/tcpsocket.cc')
-rw-r--r--server/src/tcpsocket.cc22
1 files changed, 16 insertions, 6 deletions
diff --git a/server/src/tcpsocket.cc b/server/src/tcpsocket.cc
index 70722ed..b54b581 100644
--- a/server/src/tcpsocket.cc
+++ b/server/src/tcpsocket.cc
@@ -367,9 +367,19 @@ std::string TCPSocket::dstaddr()
}
#ifdef TEST_TCPSOCKET
+//deps: exception.cc debug.cc log.cc
+//cflags: -I..
+//libs:
+#include <test.h>
-int main()
-{
+#define PORT 12346
+
+TEST_BEGIN;
+
+// TODO: Put some testcode here (see test.h for usable macros).
+TEST_TRUE(false, "No tests yet!");
+
+/*
char buf[32];
switch(fork()) {
@@ -381,7 +391,7 @@ int main()
try {
TCPSocket client;
sleep(1); // We need to wait for the listen socket to be created.
- client.connect("localhost", 12345);
+ client.connect("localhost", PORT);
sprintf(buf, "hello");
client.write(buf, sizeof(buf));
printf("Sent: [%s]\n", buf);
@@ -394,7 +404,7 @@ int main()
default: // parent
try {
TCPSocket listen_sock;
- listen_sock.listen(12345);
+ listen_sock.listen(PORT);
TCPSocket *sock = listen_sock.accept();
sock->read(buf, sizeof(buf));
printf("Got: [%s]\n", buf);
@@ -406,8 +416,8 @@ int main()
}
break;
}
+*/
- return 0;
-}
+TEST_END;
#endif/*TEST_TCPSOCKET*/