|
From: <at...@us...> - 2007-08-21 08:33:51
|
Revision: 480
http://cadcdev.svn.sourceforge.net/cadcdev/?rev=480&view=rev
Author: atani
Date: 2007-08-21 01:33:49 -0700 (Tue, 21 Aug 2007)
Log Message:
-----------
basic chat (not implemented) and chatd (partially implemented)
Added Paths:
-----------
tiki/examples/net/chat/
tiki/examples/net/chat/Makefile
tiki/examples/net/chat/chat.vcproj
tiki/examples/net/chat/src/
tiki/examples/net/chat/src/ChatClient.cpp
tiki/examples/net/chat/src/main.cpp
tiki/examples/net/chatd/
tiki/examples/net/chatd/Makefile
tiki/examples/net/chatd/chatd.vcproj
tiki/examples/net/chatd/src/
tiki/examples/net/chatd/src/ChatServer.cpp
tiki/examples/net/chatd/src/main.cpp
Added: tiki/examples/net/chat/Makefile
===================================================================
--- tiki/examples/net/chat/Makefile (rev 0)
+++ tiki/examples/net/chat/Makefile 2007-08-21 08:33:49 UTC (rev 480)
@@ -0,0 +1,13 @@
+
+TIKI_DIR=../../../
+CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
+OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
+
+all: $(OBJS)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o basic
+
+clean:
+ -rm -f $(OBJS) basic
+
+DEPSDIR=$(CURDIR)
+include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Added: tiki/examples/net/chat/chat.vcproj
===================================================================
--- tiki/examples/net/chat/chat.vcproj (rev 0)
+++ tiki/examples/net/chat/chat.vcproj 2007-08-21 08:33:49 UTC (rev 480)
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="ChatClient"
+ ProjectGUID="{7B823C96-860C-4578-95DD-1087A45AF1AA}"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
+ IgnoreDefaultLibraryNames=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\src\ChatClient.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\main.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: tiki/examples/net/chat/src/ChatClient.cpp
===================================================================
--- tiki/examples/net/chat/src/ChatClient.cpp (rev 0)
+++ tiki/examples/net/chat/src/ChatClient.cpp 2007-08-21 08:33:49 UTC (rev 480)
@@ -0,0 +1,27 @@
+/*
+* Basic.cpp
+* Basic Network test
+*
+* Copyright (C)2007 Atani Software
+*
+*/
+
+#include <Tiki/tiki.h>
+#include <pch.h>
+
+#if TIKI_PLAT == TIKI_WIN32
+#include <windows.h>
+
+static char szAppName[] = "BasicNetTest";
+int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
+#else
+extern "C" int tiki_main( int argc, char *argv[] );
+int main( int argc, char *argv[] )
+#endif
+{
+#if TIKI_PLAT != TIKI_WIN32
+ return tiki_main( argc, argv );
+#else
+ return Tiki::DoMain( szAppName, hInst, hPrevInstance, lpCmdLine, nCmdShow );
+#endif
+}
Added: tiki/examples/net/chat/src/main.cpp
===================================================================
--- tiki/examples/net/chat/src/main.cpp (rev 0)
+++ tiki/examples/net/chat/src/main.cpp 2007-08-21 08:33:49 UTC (rev 480)
@@ -0,0 +1,27 @@
+/*
+* main.cpp
+* Simple Chat Client Main method
+*
+* Copyright (C)2007 Atani Software
+*
+*/
+
+#include <Tiki/tiki.h>
+#include <Tiki/refcnt.h>
+#include <Tiki/tikitime.h>
+#include <Tiki/net.h>
+
+using namespace Tiki;
+using namespace Tiki::Debug;
+using namespace Tiki::Net;
+using namespace Tiki::Net::TCP;
+using namespace Tiki::Time;
+
+extern "C" int tiki_main( int argc, char **argv) {
+
+ Tiki::init(argc, argv);
+ Tiki::Net::init();
+
+ Tiki::Net::shutdown();
+ return 0;
+}
Added: tiki/examples/net/chatd/Makefile
===================================================================
--- tiki/examples/net/chatd/Makefile (rev 0)
+++ tiki/examples/net/chatd/Makefile 2007-08-21 08:33:49 UTC (rev 480)
@@ -0,0 +1,13 @@
+
+TIKI_DIR=../../../
+CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include
+OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
+
+all: $(OBJS)
+ $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o basic
+
+clean:
+ -rm -f $(OBJS) basic
+
+DEPSDIR=$(CURDIR)
+include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules
Added: tiki/examples/net/chatd/chatd.vcproj
===================================================================
--- tiki/examples/net/chatd/chatd.vcproj (rev 0)
+++ tiki/examples/net/chatd/chatd.vcproj 2007-08-21 08:33:49 UTC (rev 480)
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="ChatServer"
+ ProjectGUID="{7B823C96-860C-4578-95EE-1087A45AF1AA}"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="Debug"
+ IntermediateDirectory="Debug"
+ ConfigurationType="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Debug;"C:\Program Files\OpenAL 1.1 SDK\libs\Win32""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="Release"
+ IntermediateDirectory="Release"
+ ConfigurationType="1"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="$(ProjectDir)\..\..\..\win32\include;$(ProjectDir)\..\..\..\include;"C:\Program Files\OpenAL 1.1 SDK\include""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
+ RuntimeLibrary="0"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="gdi32.lib kernel32.lib user32.lib opengl32.lib glu32.lib comdlg32.lib ws2_32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(ProjectDir)\..\..\..\win32\Release;C:\Program Files\OpenAL 1.1 SDK\libs\Win32"
+ IgnoreDefaultLibraryNames=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\src\ChatServer.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\src\main.cpp"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: tiki/examples/net/chatd/src/ChatServer.cpp
===================================================================
--- tiki/examples/net/chatd/src/ChatServer.cpp (rev 0)
+++ tiki/examples/net/chatd/src/ChatServer.cpp 2007-08-21 08:33:49 UTC (rev 480)
@@ -0,0 +1,27 @@
+/*
+* Basic.cpp
+* Basic Network test
+*
+* Copyright (C)2007 Atani Software
+*
+*/
+
+#include <Tiki/tiki.h>
+#include <pch.h>
+
+#if TIKI_PLAT == TIKI_WIN32
+#include <windows.h>
+
+static char szAppName[] = "BasicNetTest";
+int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
+#else
+extern "C" int tiki_main( int argc, char *argv[] );
+int main( int argc, char *argv[] )
+#endif
+{
+#if TIKI_PLAT != TIKI_WIN32
+ return tiki_main( argc, argv );
+#else
+ return Tiki::DoMain( szAppName, hInst, hPrevInstance, lpCmdLine, nCmdShow );
+#endif
+}
Added: tiki/examples/net/chatd/src/main.cpp
===================================================================
--- tiki/examples/net/chatd/src/main.cpp (rev 0)
+++ tiki/examples/net/chatd/src/main.cpp 2007-08-21 08:33:49 UTC (rev 480)
@@ -0,0 +1,150 @@
+/*
+* main.cpp
+* Simple Chat Server Main method
+*
+* Copyright (C)2007 Atani Software
+*
+*/
+
+#include <vector>
+#include <Tiki/tiki.h>
+#include <Tiki/hid.h>
+#include <Tiki/refcnt.h>
+#include <Tiki/thread.h>
+#include <Tiki/tikitime.h>
+#include <Tiki/net.h>
+
+using namespace Tiki;
+using namespace Tiki::Debug;
+using namespace Tiki::Net;
+using namespace Tiki::Net::TCP;
+using namespace Tiki::Thread;
+
+std::vector< RefPtr< TCPSocket > > g_threads;
+
+std::string g_welcomeText("Welcome to the Tiki Chat Server\nType /HELP for list of commands\n");
+std::string g_goodbyeText("So long from the Tiki Chat Server\n");
+std::string g_helpText("/HELP : this text\n/QUIT : close connection to server\n");
+std::string g_invalidCmdText("Invalid or unrecognized command\n");
+
+std::map<std::string, void (*)( TCPSocket * )> g_commandHandlers;
+
+volatile bool quitting = false;
+void tkCallback( const Hid::Event & evt, void * data ) {
+ if ( evt.type == Hid::Event::EvtQuit ) {
+ quitting = true;
+ }
+}
+
+void helpCommand( TCPSocket *user ) {
+ RefPtr<Buffer> buf = new Buffer(g_helpText.size());
+ buf->setData((uint8 *)g_helpText.c_str(), g_helpText.size());
+ user->send(buf);
+}
+
+void quitCommand( TCPSocket *user ) {
+ Tiki::Debug::printf("Closing connection from: %s\n",
+ user->getPeerAddress()->getIPAddressString().c_str());
+ RefPtr<Buffer> buf = new Buffer(g_goodbyeText.size());
+ buf->setData((uint8 *)g_goodbyeText.c_str(), g_goodbyeText.size());
+ user->send(buf);
+ user->close();
+}
+
+void loadCommandHandlers()
+{
+ g_commandHandlers.clear();
+ g_commandHandlers.insert(std::make_pair("HELP", &helpCommand));
+ g_commandHandlers.insert(std::make_pair("QUIT", &helpCommand));
+}
+
+void *connectionHandler(void *param) {
+ RefPtr<TCPSocket> socket = ( TCPSocket * )(param);
+ RefPtr<Buffer> buf = new Buffer(g_welcomeText.size());
+ buf->setData((uint8 *)g_welcomeText.c_str(), g_welcomeText.size());
+ socket->send(buf);
+
+ RefPtr<Buffer> line = new Buffer(1024);
+ while(socket->isOpen() && !quitting) {
+ line->reset();
+ socket->recv(line);
+ if(line->getUsedDataLen() > 0)
+ {
+ socket->send(line);
+ }
+ else
+ {
+ socket->close();
+ return NULL;
+ }
+ if(line->getData()[0] == '/')
+ {
+ uint8 *data = line->getData();
+ data[line->getUsedDataLen() - 1] = '\0';
+ data[line->getUsedDataLen() - 2] = '\0';
+ string cmd = "";
+ for(int i = 1; i < line->getUsedDataLen() - 2; i++)
+ {
+ cmd.push_back(data[i]);
+ }
+ Tiki::Debug::printf("cmd: %s\n", cmd.c_str());
+ std::map<std::string, void (*)( TCPSocket * )>::const_iterator i =
+ g_commandHandlers.find( cmd );
+ if( i != g_commandHandlers.end() ){
+ i->second(socket);
+ }
+ else
+ {
+ RefPtr<Buffer> tmpBuf = new Buffer(g_invalidCmdText.size());
+ tmpBuf->setData((uint8 *)g_helpText.c_str(), g_invalidCmdText.size());
+ socket->send(tmpBuf);
+ }
+ }
+ }
+ Tiki::Debug::printf("Closing connection from: %s\n",
+ socket->getPeerAddress()->getIPAddressString().c_str());
+ socket->close();
+ return NULL;
+}
+
+extern "C" int tiki_main( int argc, char **argv) {
+ Tiki::Net::init();
+
+ Hid::callbackReg( tkCallback, NULL );
+
+ loadCommandHandlers();
+
+ RefPtr<Address> local = new Address();
+ local->setHostName("localhost");
+ local->setIPAddress(Address::AddressAny);
+ RefPtr<TCPServerSocket> server = new TCPServerSocket(local);
+ server->setLocalAddress(local);
+ server->setPort(5555);
+
+ server->open();
+
+ if(server->isOpen())
+ {
+ server->bind();
+ Tiki::Debug::printf("Listening on: %s/%u\n",
+ server->getLocalAddress()->getIPAddressString().c_str(),
+ server->getPort());
+ if(server->isOpen()) {
+
+ while(!quitting) {
+ RefPtr<TCPSocket> newsocket = server->accept();
+ if(newsocket != NULL) {
+ Tiki::Debug::printf("New connection from: %s\n",
+ newsocket->getPeerAddress()->getIPAddressString().c_str());
+ newsocket->ref();
+ g_threads.push_back( newsocket );
+ thread_t thread;
+ Tiki::Thread::create(&thread, &connectionHandler, newsocket);
+ }
+ }
+ }
+ }
+
+ Tiki::Net::shutdown();
+ return 0;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|