diff options
author | Erwin Coumans <erwin.coumans@gmail.com> | 2017-02-19 12:08:58 -0800 |
---|---|---|
committer | Erwin Coumans <erwin.coumans@gmail.com> | 2017-02-19 12:08:58 -0800 |
commit | 3faab1b019c231f20c3d80e9c9c36cc7f3e88d63 (patch) | |
tree | d9613015a2b2ccfb2327a811a95dbd3eb7d542a5 | |
parent | 4faa6613c9e6457e85e10b543eadfb05d046b6c9 (diff) | |
download | bullet3-3faab1b019c231f20c3d80e9c9c36cc7f3e88d63.tar.gz |
adjusted clsocket build and test, so there is an EchoServer and QueryDayTime sending a string to the EchoServer.
-rw-r--r-- | build3/premake4.lua | 17 | ||||
-rw-r--r-- | examples/ThirdPartyLibs/clsocket/premake4.lua | 2 | ||||
-rw-r--r-- | test/clsocket/EchoServer.cpp | 4 | ||||
-rw-r--r-- | test/clsocket/QueryDayTime.cpp | 8 | ||||
-rw-r--r-- | test/clsocket/premake4.lua | 51 |
5 files changed, 74 insertions, 8 deletions
diff --git a/build3/premake4.lua b/build3/premake4.lua index a5187efa7..345091d3e 100644 --- a/build3/premake4.lua +++ b/build3/premake4.lua @@ -73,8 +73,15 @@ newoption { + trigger = "no-clsocket", + description = "Disable clsocket and clsocket tests (used for optional TCP networking in pybullet and shared memory C-API)" + } + + + newoption + { trigger = "no-enet", - description = "Disable enet and enet tests" + description = "Disable enet and enet tests (used for optional UDP networking in pybullet and shared memory C-API)" } newoption @@ -271,18 +278,20 @@ end include "../examples/ThirdPartyLibs/midi" end - if not _OPTIONS["no_clsocket"] then - include "../examples/ThirdPartyLibs/clsocket" + if not _OPTIONS["no-clsocket"] then defines {"BT_ENABLE_CLSOCKET"} + include "../examples/ThirdPartyLibs/clsocket" + include "../test/clsocket" end if not _OPTIONS["no-enet"] then + defines {"BT_ENABLE_ENET"} + include "../examples/ThirdPartyLibs/enet" include "../test/enet/nat_punchthrough/client" include "../test/enet/nat_punchthrough/server" include "../test/enet/chat/client" include "../test/enet/chat/server" - defines {"BT_ENABLE_ENET"} end if _OPTIONS["no-bullet3"] then diff --git a/examples/ThirdPartyLibs/clsocket/premake4.lua b/examples/ThirdPartyLibs/clsocket/premake4.lua index 896185095..57447b1fa 100644 --- a/examples/ThirdPartyLibs/clsocket/premake4.lua +++ b/examples/ThirdPartyLibs/clsocket/premake4.lua @@ -14,7 +14,7 @@ includedirs { - ".","include" + ".","include","src" } files { "src/SimpleSocket.cpp", diff --git a/test/clsocket/EchoServer.cpp b/test/clsocket/EchoServer.cpp index 4a27d278f..4173e5e6a 100644 --- a/test/clsocket/EchoServer.cpp +++ b/test/clsocket/EchoServer.cpp @@ -19,11 +19,15 @@ int main(int argc, char **argv) { if ((pClient = socket.Accept()) != NULL) { + int clientPort = socket.GetClientPort(); + printf("connected from %s:%d\n", socket.GetClientAddr(),clientPort); //---------------------------------------------------------------------- // Receive request from the client. //---------------------------------------------------------------------- if (pClient->Receive(MAX_PACKET)) { + char* msg = (char*) pClient->GetData(); + printf("received message [%s]\n",msg); //------------------------------------------------------------------ // Send response to client and close connection to the client. //------------------------------------------------------------------ diff --git a/test/clsocket/QueryDayTime.cpp b/test/clsocket/QueryDayTime.cpp index a853abfab..46084256d 100644 --- a/test/clsocket/QueryDayTime.cpp +++ b/test/clsocket/QueryDayTime.cpp @@ -24,10 +24,12 @@ int main(int argc, char **argv) //---------------------------------------------------------------------- // Send a requtest the server requesting the current time. //---------------------------------------------------------------------- - const char* data = "Hello!"; + char data[1024]; + sprintf(data,"%s","Hello!"); int len = strlen(data); - - if (socket.Send((const uint8 *)"HELLO\n", len)) + data[len]=0; + len++; + if (socket.Send((const uint8 *)data, len)) { //---------------------------------------------------------------------- // Receive response from the server. diff --git a/test/clsocket/premake4.lua b/test/clsocket/premake4.lua new file mode 100644 index 000000000..530cbdb90 --- /dev/null +++ b/test/clsocket/premake4.lua @@ -0,0 +1,51 @@ + + +project ("Test_clsocket_EchoServer") + + language "C++" + + kind "ConsoleApp" + + includedirs {"../../examples/ThirdPartyLibs/clsocket/src"} + + if os.is("Windows") then + defines { "WIN32" } + links {"Ws2_32","Winmm"} + end + if os.is("Linux") then + end + if os.is("MacOSX") then + end + + links {"clsocket"} + + files { + "EchoServer.cpp", + } + + + + +project ("Test_clsocket_QueryDayTime") + + language "C++" + + kind "ConsoleApp" + + includedirs {"../../examples/ThirdPartyLibs/clsocket/src"} + + if os.is("Windows") then + defines { "WIN32" } + links {"Ws2_32","Winmm"} + end + if os.is("Linux") then + end + if os.is("MacOSX") then + end + + links {"clsocket"} + + files { + "QueryDayTime.cpp", + } + |