increased chunk size
Fork of MTS-Socket by
Diff: Test/TestUDPSocket.h
- Revision:
- 14:7643ed024fe8
- Parent:
- 12:9efe3cc3cb6c
- Child:
- 16:dbe80ac199f5
diff -r 9efe3cc3cb6c -r 7643ed024fe8 Test/TestUDPSocket.h --- a/Test/TestUDPSocket.h Mon Jun 23 14:33:39 2014 +0000 +++ b/Test/TestUDPSocket.h Wed Jul 23 16:01:16 2014 +0000 @@ -17,9 +17,11 @@ UDPSocket* sock; }; +//Must set test server and test port before running socket test const char UDP_TEST_SERVER[] = ""; const int UDP_TEST_PORT = -1; +//Test pattern can be changed to any alphanumeric pattern wanted const char TEST_PATTERN[] = "abcdefghijklmnopqrstuvwzyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()[]{}|\r\n" "abcdefghijklmnopqrstuvwzyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()[]{}/\r\n" "abcdefghijklmnopqrstuvwzyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()[]{}-\r\n" @@ -59,6 +61,7 @@ wait(1); } } + for (int i = 0; i < 3; i++) { if (i >= 3) { Test::assertTrue(false); @@ -82,12 +85,14 @@ } sock = new UDPSocket(); - sock->set_blocking(false, 10000); + sock->set_blocking(false, 20000); Test::end(); - /* set up an UDP echo server using netcat + /** set up an UDP echo server using netcat * nc -e /bin/cat -l -u -p TEST_PORT - * this should echo back anything you send to it + * this should echo back anything you send to it. + * Note: Listen port might close after each UDP packet + * if testing UIP-type radios. */ int bufsize = 1024; @@ -118,6 +123,8 @@ Test::end(); wait(5); } + sock->close(); + radio->disconnect(); } #endif \ No newline at end of file