From 2804f77d88eb478f85a281b19d87e38cd96e0d0c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 19 Dec 2007 16:45:08 +0000 Subject: [PATCH] more socket cleanup to allow using wxSocket from both wxBase and wxCore (replaces patch 1756260) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50831 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- Makefile.in | 398 ++++++++----- build/bakefiles/files.bkl | 9 +- build/msw/makefile.bcc | 44 +- build/msw/makefile.gcc | 44 +- build/msw/makefile.vc | 44 +- build/msw/makefile.wat | 44 +- build/msw/wx_core.dsp | 4 - build/msw/wx_net.dsp | 4 + configure.in | 12 +- docs/changes.txt | 2 +- include/wx/apptrait.h | 18 +- include/wx/gsocket.h | 142 +++-- include/wx/motif/private.h | 3 +- include/wx/msw/apptbase.h | 22 + include/wx/msw/gsockmsw.h | 42 +- include/wx/private/gsocketiohandler.h | 31 +- include/wx/unix/apptbase.h | 7 + include/wx/unix/apptrait.h | 11 + include/wx/unix/gsockunx.h | 174 ++++-- samples/sockets/Makefile.in | 110 ++-- samples/sockets/baseclient.cpp | 733 ++++++++++++++++++++++++ samples/sockets/baseserver.cpp | 738 +++++++++++++++++++++++++ samples/sockets/client.cpp | 4 +- samples/sockets/makefile.bcc | 164 ++++-- samples/sockets/makefile.gcc | 140 +++-- samples/sockets/makefile.unx | 24 +- samples/sockets/makefile.vc | 206 ++++--- samples/sockets/makefile.wat | 148 +++-- samples/sockets/server.cpp | 4 +- samples/sockets/sockets.bkl | 26 +- samples/sockets/sockets_baseclient.dsp | 243 ++++++++ samples/sockets/sockets_baseserver.dsp | 243 ++++++++ src/common/appbase.cpp | 7 - src/common/appcmn.cpp | 25 - src/common/fdiodispatcher.cpp | 2 +- src/common/gsocketiohandler.cpp | 244 +++----- src/common/selectdispatcher.cpp | 15 +- src/common/socket.cpp | 88 ++- src/gtk/gsockgtk.cpp | 131 ++--- src/gtk1/gsockgtk.cpp | 138 ++--- src/mac/carbon/gsocket.cpp | 12 +- src/mac/corefoundation/gsockosx.cpp | 398 ++++++++----- src/motif/gsockmot.cpp | 138 ++--- src/msw/basemsw.cpp | 2 + src/msw/evtloop.cpp | 2 +- src/msw/gsocket.cpp | 283 +--------- src/msw/gsockmsw.cpp | 120 ++-- src/os2/gsockpm.cpp | 28 - src/unix/baseunix.cpp | 1 + src/unix/epolldispatcher.cpp | 10 +- src/unix/gsocket.cpp | 247 +++------ wxGTK.spec | 1 + wxMotif.spec | 1 + wxX11.spec | 1 + 54 files changed, 3808 insertions(+), 1924 deletions(-) create mode 100644 samples/sockets/baseclient.cpp create mode 100644 samples/sockets/baseserver.cpp create mode 100644 samples/sockets/sockets_baseclient.dsp create mode 100644 samples/sockets/sockets_baseserver.dsp diff --git a/Makefile.in b/Makefile.in index 32d50bc871..05d697e5f0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -570,6 +570,7 @@ ALL_PORTS_BASE_HEADERS = \ wx/zipstrm.h \ wx/zstream.h \ wx/private/fdiodispatcher.h \ + wx/private/gsocketiohandler.h \ wx/private/selectdispatcher.h \ wx/unix/app.h \ wx/unix/apptbase.h \ @@ -706,6 +707,7 @@ ALL_BASE_SOURCES = \ src/common/xtistrm.cpp \ src/common/zipstrm.cpp \ src/common/zstream.cpp \ + src/common/gsocketiohandler.cpp \ src/common/fdiodispatcher.cpp \ src/common/selectdispatcher.cpp \ src/unix/appunix.cpp \ @@ -743,6 +745,7 @@ ALL_BASE_SOURCES = \ src/mac/carbon/thread.cpp \ src/mac/carbon/morefilex/MoreFilesX.c \ src/mac/corefoundation/cfstring.cpp \ + src/mac/corefoundation/gsockosx.cpp \ src/mac/corefoundation/stdpaths_cf.cpp \ src/mac/corefoundation/strconv_cf.cpp \ src/mac/corefoundation/utilsexc_base.cpp \ @@ -791,6 +794,7 @@ ALL_BASE_SOURCES = \ src/common/url.cpp \ src/unix/gsocket.cpp \ src/msw/gsocket.cpp \ + src/msw/gsockmsw.cpp \ src/msw/urlmsw.cpp \ $(NET_WINCE_SRC) \ src/xml/xml.cpp \ @@ -1804,6 +1808,7 @@ COND_USE_STC_1___wxscintilla___depname = \ @COND_TOOLKIT_X11@OPENGL_HDR_PLATFORM = wx/x11/glcanvas.h wx/unix/glx11.h COND_TOOLKIT__BASE_MACOSX_HDR = \ wx/private/fdiodispatcher.h \ + wx/private/gsocketiohandler.h \ wx/private/selectdispatcher.h \ wx/unix/app.h \ wx/unix/apptbase.h \ @@ -1825,6 +1830,7 @@ COND_TOOLKIT__BASE_MACOSX_HDR = \ @COND_TOOLKIT_@BASE_MACOSX_HDR = $(COND_TOOLKIT__BASE_MACOSX_HDR) COND_TOOLKIT_COCOA_BASE_MACOSX_HDR = \ wx/private/fdiodispatcher.h \ + wx/private/gsocketiohandler.h \ wx/private/selectdispatcher.h \ wx/unix/app.h \ wx/unix/apptbase.h \ @@ -1846,6 +1852,7 @@ COND_TOOLKIT_COCOA_BASE_MACOSX_HDR = \ @COND_TOOLKIT_COCOA@BASE_MACOSX_HDR = $(COND_TOOLKIT_COCOA_BASE_MACOSX_HDR) COND_TOOLKIT_GTK_BASE_MACOSX_HDR = \ wx/private/fdiodispatcher.h \ + wx/private/gsocketiohandler.h \ wx/private/selectdispatcher.h \ wx/unix/app.h \ wx/unix/apptbase.h \ @@ -1884,6 +1891,7 @@ COND_TOOLKIT_MAC_BASE_MACOSX_HDR = \ @COND_TOOLKIT_MAC@BASE_MACOSX_HDR = $(COND_TOOLKIT_MAC_BASE_MACOSX_HDR) COND_TOOLKIT_MOTIF_BASE_MACOSX_HDR = \ wx/private/fdiodispatcher.h \ + wx/private/gsocketiohandler.h \ wx/private/selectdispatcher.h \ wx/unix/app.h \ wx/unix/apptbase.h \ @@ -1905,6 +1913,7 @@ COND_TOOLKIT_MOTIF_BASE_MACOSX_HDR = \ @COND_TOOLKIT_MOTIF@BASE_MACOSX_HDR = $(COND_TOOLKIT_MOTIF_BASE_MACOSX_HDR) COND_TOOLKIT_X11_BASE_MACOSX_HDR = \ wx/private/fdiodispatcher.h \ + wx/private/gsocketiohandler.h \ wx/private/selectdispatcher.h \ wx/unix/app.h \ wx/unix/apptbase.h \ @@ -1941,6 +1950,7 @@ COND_PLATFORM_OS2_1_BASE_PLATFORM_HDR = \ @COND_PLATFORM_OS2_1@BASE_PLATFORM_HDR = $(COND_PLATFORM_OS2_1_BASE_PLATFORM_HDR) COND_PLATFORM_UNIX_1_BASE_PLATFORM_HDR = \ wx/private/fdiodispatcher.h \ + wx/private/gsocketiohandler.h \ wx/private/selectdispatcher.h \ wx/unix/app.h \ wx/unix/apptbase.h \ @@ -3484,6 +3494,7 @@ COND_PLATFORM_MACOS_1___BASE_PLATFORM_SRC_OBJECTS = \ monodll_thread.o \ monodll_MoreFilesX.o \ monodll_cfstring.o \ + monodll_gsockosx.o \ monodll_stdpaths_cf.o \ monodll_strconv_cf.o \ monodll_utilsexc_base.o \ @@ -3514,6 +3525,7 @@ COND_PLATFORM_OS2_1___BASE_PLATFORM_SRC_OBJECTS = \ monodll_utilsexc.o @COND_PLATFORM_OS2_1@__BASE_PLATFORM_SRC_OBJECTS = $(COND_PLATFORM_OS2_1___BASE_PLATFORM_SRC_OBJECTS) COND_PLATFORM_UNIX_1___BASE_PLATFORM_SRC_OBJECTS = \ + monodll_gsocketiohandler.o \ monodll_fdiodispatcher.o \ monodll_selectdispatcher.o \ monodll_appunix.o \ @@ -3551,6 +3563,7 @@ COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS = \ @COND_PLATFORM_WIN32_1@__BASE_PLATFORM_SRC_OBJECTS = $(COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS) @COND_TOOLKIT_WINCE@__BASE_WINCE_SRC_OBJECTS = monodll_time.o COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS = \ + monodll_gsocketiohandler.o \ monodll_fdiodispatcher.o \ monodll_selectdispatcher.o \ monodll_appunix.o \ @@ -3566,11 +3579,13 @@ COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS = \ monodll_threadpsx.o \ monodll_timerunx.o \ monodll_cfstring.o \ + monodll_gsockosx.o \ monodll_stdpaths_cf.o \ monodll_strconv_cf.o \ monodll_utilsexc_base.o @COND_TOOLKIT_@__BASE_MACOSX_SRC_OBJECTS = $(COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS) COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS = \ + monodll_gsocketiohandler.o \ monodll_fdiodispatcher.o \ monodll_selectdispatcher.o \ monodll_appunix.o \ @@ -3586,11 +3601,13 @@ COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS = \ monodll_threadpsx.o \ monodll_timerunx.o \ monodll_cfstring.o \ + monodll_gsockosx.o \ monodll_stdpaths_cf.o \ monodll_strconv_cf.o \ monodll_utilsexc_base.o @COND_TOOLKIT_COCOA@__BASE_MACOSX_SRC_OBJECTS = $(COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS) COND_TOOLKIT_GTK___BASE_MACOSX_SRC_OBJECTS = \ + monodll_gsocketiohandler.o \ monodll_fdiodispatcher.o \ monodll_selectdispatcher.o \ monodll_appunix.o \ @@ -3606,6 +3623,7 @@ COND_TOOLKIT_GTK___BASE_MACOSX_SRC_OBJECTS = \ monodll_threadpsx.o \ monodll_timerunx.o \ monodll_cfstring.o \ + monodll_gsockosx.o \ monodll_stdpaths_cf.o \ monodll_strconv_cf.o \ monodll_utilsexc_base.o @@ -3616,6 +3634,7 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS = \ monodll_thread.o \ monodll_MoreFilesX.o \ monodll_cfstring.o \ + monodll_gsockosx.o \ monodll_stdpaths_cf.o \ monodll_strconv_cf.o \ monodll_utilsexc_base.o \ @@ -3630,6 +3649,7 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS = \ monodll_timerunx.o @COND_TOOLKIT_MAC@__BASE_MACOSX_SRC_OBJECTS = $(COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS) COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS = \ + monodll_gsocketiohandler.o \ monodll_fdiodispatcher.o \ monodll_selectdispatcher.o \ monodll_appunix.o \ @@ -3645,11 +3665,13 @@ COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS = \ monodll_threadpsx.o \ monodll_timerunx.o \ monodll_cfstring.o \ + monodll_gsockosx.o \ monodll_stdpaths_cf.o \ monodll_strconv_cf.o \ monodll_utilsexc_base.o @COND_TOOLKIT_MOTIF@__BASE_MACOSX_SRC_OBJECTS = $(COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS) COND_TOOLKIT_X11___BASE_MACOSX_SRC_OBJECTS = \ + monodll_gsocketiohandler.o \ monodll_fdiodispatcher.o \ monodll_selectdispatcher.o \ monodll_appunix.o \ @@ -3665,6 +3687,7 @@ COND_TOOLKIT_X11___BASE_MACOSX_SRC_OBJECTS = \ monodll_threadpsx.o \ monodll_timerunx.o \ monodll_cfstring.o \ + monodll_gsockosx.o \ monodll_stdpaths_cf.o \ monodll_strconv_cf.o \ monodll_utilsexc_base.o @@ -3683,9 +3706,12 @@ COND_TOOLKIT_X11___BASE_MACOSX_SRC_OBJECTS = \ @COND_PLATFORM_MACOS_1@__NET_PLATFORM_SRC_OBJECTS = monodll_gsocket.o @COND_PLATFORM_OS2_1@__NET_PLATFORM_SRC_OBJECTS = monodll_gsocket.o @COND_PLATFORM_UNIX_1@__NET_PLATFORM_SRC_OBJECTS = monodll_gsocket.o -@COND_PLATFORM_WIN32_1@__NET_PLATFORM_SRC_OBJECTS = \ -@COND_PLATFORM_WIN32_1@ monodll_gsocket.o monodll_urlmsw.o \ -@COND_PLATFORM_WIN32_1@ $(__NET_WINCE_SRC_OBJECTS) +COND_PLATFORM_WIN32_1___NET_PLATFORM_SRC_OBJECTS = \ + monodll_gsocket.o \ + monodll_gsockmsw.o \ + monodll_urlmsw.o \ + $(__NET_WINCE_SRC_OBJECTS) +@COND_PLATFORM_WIN32_1@__NET_PLATFORM_SRC_OBJECTS = $(COND_PLATFORM_WIN32_1___NET_PLATFORM_SRC_OBJECTS) @COND_TOOLKIT_WINCE@__NET_WINCE_SRC_OBJECTS = monodll_net.o COND_USE_GUI_1___MONOLIB_GUI_SRC_OBJECTS = \ $(__CORE_SRC_OBJECTS) \ @@ -4104,10 +4130,9 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS = \ monodll_vscroll.o @COND_USE_GUI_1_WXUNIV_1@__CORE_SRC_OBJECTS = $(COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS) @COND_TOOLKIT_COCOA@__LOWLEVEL_SRC_OBJECTS = \ -@COND_TOOLKIT_COCOA@ monodll_gsockosx.o monodll_hid.o monodll_utilsexc_cf.o +@COND_TOOLKIT_COCOA@ monodll_hid.o monodll_utilsexc_cf.o COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS = \ monodll_fontmgrcmn.o \ - monodll_gsocketiohandler.o \ monodll_caret.o \ monodll_colour.o \ monodll_icon.o \ @@ -4289,7 +4314,6 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS = \ monodll_gdiobj.o \ monodll_gdiplus.o \ monodll_graphics.o \ - monodll_gsockmsw.o \ monodll_icon.o \ monodll_imaglist.o \ monodll_minifram.o \ @@ -4341,7 +4365,6 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS = \ monodll_gdiobj.o \ monodll_gdiplus.o \ monodll_graphics.o \ - monodll_gsockmsw.o \ monodll_icon.o \ monodll_imaglist.o \ monodll_minifram.o \ @@ -4371,7 +4394,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS = \ monodll_fontutil.o \ monodll_utilsx11.o \ monodll_displayx11.o \ - monodll_gsocketiohandler.o \ monodll_icon.o \ monodll_timer.o \ monodll_app.o \ @@ -4972,10 +4994,9 @@ COND_PLATFORM_MACOSX_1___MAC_OSX_SRC_OBJECTS = \ monodll_utilscocoa.o @COND_PLATFORM_MACOSX_1@__MAC_OSX_SRC_OBJECTS = $(COND_PLATFORM_MACOSX_1___MAC_OSX_SRC_OBJECTS) @COND_TOOLKIT_COCOA@__LOWLEVEL_SRC_OBJECTS_1 = \ -@COND_TOOLKIT_COCOA@ monodll_gsockosx.o monodll_hid.o monodll_utilsexc_cf.o +@COND_TOOLKIT_COCOA@ monodll_hid.o monodll_utilsexc_cf.o COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS_1 = \ monodll_fontmgrcmn.o \ - monodll_gsocketiohandler.o \ monodll_caret.o \ monodll_colour.o \ monodll_icon.o \ @@ -5157,7 +5178,6 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_1 = \ monodll_gdiobj.o \ monodll_gdiplus.o \ monodll_graphics.o \ - monodll_gsockmsw.o \ monodll_icon.o \ monodll_imaglist.o \ monodll_minifram.o \ @@ -5209,7 +5229,6 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_1 = \ monodll_gdiobj.o \ monodll_gdiplus.o \ monodll_graphics.o \ - monodll_gsockmsw.o \ monodll_icon.o \ monodll_imaglist.o \ monodll_minifram.o \ @@ -5239,7 +5258,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_1 = \ monodll_fontutil.o \ monodll_utilsx11.o \ monodll_displayx11.o \ - monodll_gsocketiohandler.o \ monodll_icon.o \ monodll_timer.o \ monodll_app.o \ @@ -5378,6 +5396,7 @@ COND_PLATFORM_MACOS_1___BASE_PLATFORM_SRC_OBJECTS_1 = \ monolib_thread.o \ monolib_MoreFilesX.o \ monolib_cfstring.o \ + monolib_gsockosx.o \ monolib_stdpaths_cf.o \ monolib_strconv_cf.o \ monolib_utilsexc_base.o \ @@ -5409,6 +5428,7 @@ COND_PLATFORM_OS2_1___BASE_PLATFORM_SRC_OBJECTS_1 = \ monolib_utilsexc.o @COND_PLATFORM_OS2_1@__BASE_PLATFORM_SRC_OBJECTS_1 = $(COND_PLATFORM_OS2_1___BASE_PLATFORM_SRC_OBJECTS_1) COND_PLATFORM_UNIX_1___BASE_PLATFORM_SRC_OBJECTS_1 = \ + monolib_gsocketiohandler.o \ monolib_fdiodispatcher.o \ monolib_selectdispatcher.o \ monolib_appunix.o \ @@ -5446,6 +5466,7 @@ COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS_1 = \ @COND_PLATFORM_WIN32_1@__BASE_PLATFORM_SRC_OBJECTS_1 = $(COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS_1) @COND_TOOLKIT_WINCE@__BASE_WINCE_SRC_OBJECTS_1 = monolib_time.o COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS_1 = \ + monolib_gsocketiohandler.o \ monolib_fdiodispatcher.o \ monolib_selectdispatcher.o \ monolib_appunix.o \ @@ -5461,11 +5482,13 @@ COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS_1 = \ monolib_threadpsx.o \ monolib_timerunx.o \ monolib_cfstring.o \ + monolib_gsockosx.o \ monolib_stdpaths_cf.o \ monolib_strconv_cf.o \ monolib_utilsexc_base.o @COND_TOOLKIT_@__BASE_MACOSX_SRC_OBJECTS_1 = $(COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS_1) COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS_1 = \ + monolib_gsocketiohandler.o \ monolib_fdiodispatcher.o \ monolib_selectdispatcher.o \ monolib_appunix.o \ @@ -5481,11 +5504,13 @@ COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS_1 = \ monolib_threadpsx.o \ monolib_timerunx.o \ monolib_cfstring.o \ + monolib_gsockosx.o \ monolib_stdpaths_cf.o \ monolib_strconv_cf.o \ monolib_utilsexc_base.o @COND_TOOLKIT_COCOA@__BASE_MACOSX_SRC_OBJECTS_1 = $(COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS_1) COND_TOOLKIT_GTK___BASE_MACOSX_SRC_OBJECTS_1 = \ + monolib_gsocketiohandler.o \ monolib_fdiodispatcher.o \ monolib_selectdispatcher.o \ monolib_appunix.o \ @@ -5501,6 +5526,7 @@ COND_TOOLKIT_GTK___BASE_MACOSX_SRC_OBJECTS_1 = \ monolib_threadpsx.o \ monolib_timerunx.o \ monolib_cfstring.o \ + monolib_gsockosx.o \ monolib_stdpaths_cf.o \ monolib_strconv_cf.o \ monolib_utilsexc_base.o @@ -5511,6 +5537,7 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_1 = \ monolib_thread.o \ monolib_MoreFilesX.o \ monolib_cfstring.o \ + monolib_gsockosx.o \ monolib_stdpaths_cf.o \ monolib_strconv_cf.o \ monolib_utilsexc_base.o \ @@ -5525,6 +5552,7 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_1 = \ monolib_timerunx.o @COND_TOOLKIT_MAC@__BASE_MACOSX_SRC_OBJECTS_1 = $(COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_1) COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_1 = \ + monolib_gsocketiohandler.o \ monolib_fdiodispatcher.o \ monolib_selectdispatcher.o \ monolib_appunix.o \ @@ -5540,11 +5568,13 @@ COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_1 = \ monolib_threadpsx.o \ monolib_timerunx.o \ monolib_cfstring.o \ + monolib_gsockosx.o \ monolib_stdpaths_cf.o \ monolib_strconv_cf.o \ monolib_utilsexc_base.o @COND_TOOLKIT_MOTIF@__BASE_MACOSX_SRC_OBJECTS_1 = $(COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_1) COND_TOOLKIT_X11___BASE_MACOSX_SRC_OBJECTS_1 = \ + monolib_gsocketiohandler.o \ monolib_fdiodispatcher.o \ monolib_selectdispatcher.o \ monolib_appunix.o \ @@ -5560,6 +5590,7 @@ COND_TOOLKIT_X11___BASE_MACOSX_SRC_OBJECTS_1 = \ monolib_threadpsx.o \ monolib_timerunx.o \ monolib_cfstring.o \ + monolib_gsockosx.o \ monolib_stdpaths_cf.o \ monolib_strconv_cf.o \ monolib_utilsexc_base.o @@ -5578,9 +5609,12 @@ COND_TOOLKIT_X11___BASE_MACOSX_SRC_OBJECTS_1 = \ @COND_PLATFORM_MACOS_1@__NET_PLATFORM_SRC_OBJECTS_1 = monolib_gsocket.o @COND_PLATFORM_OS2_1@__NET_PLATFORM_SRC_OBJECTS_1 = monolib_gsocket.o @COND_PLATFORM_UNIX_1@__NET_PLATFORM_SRC_OBJECTS_1 = monolib_gsocket.o -@COND_PLATFORM_WIN32_1@__NET_PLATFORM_SRC_OBJECTS_1 \ -@COND_PLATFORM_WIN32_1@ = monolib_gsocket.o monolib_urlmsw.o \ -@COND_PLATFORM_WIN32_1@ $(__NET_WINCE_SRC_OBJECTS_1) +COND_PLATFORM_WIN32_1___NET_PLATFORM_SRC_OBJECTS_1 = \ + monolib_gsocket.o \ + monolib_gsockmsw.o \ + monolib_urlmsw.o \ + $(__NET_WINCE_SRC_OBJECTS_1) +@COND_PLATFORM_WIN32_1@__NET_PLATFORM_SRC_OBJECTS_1 = $(COND_PLATFORM_WIN32_1___NET_PLATFORM_SRC_OBJECTS_1) @COND_TOOLKIT_WINCE@__NET_WINCE_SRC_OBJECTS_1 = monolib_net.o COND_USE_GUI_1___MONOLIB_GUI_SRC_OBJECTS_1 = \ $(__CORE_SRC_OBJECTS_1) \ @@ -5999,10 +6033,9 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1 = \ monolib_vscroll.o @COND_USE_GUI_1_WXUNIV_1@__CORE_SRC_OBJECTS_1 = $(COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_1) @COND_TOOLKIT_COCOA@__LOWLEVEL_SRC_OBJECTS_2 = \ -@COND_TOOLKIT_COCOA@ monolib_gsockosx.o monolib_hid.o monolib_utilsexc_cf.o +@COND_TOOLKIT_COCOA@ monolib_hid.o monolib_utilsexc_cf.o COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS_2 = \ monolib_fontmgrcmn.o \ - monolib_gsocketiohandler.o \ monolib_caret.o \ monolib_colour.o \ monolib_icon.o \ @@ -6185,7 +6218,6 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_2 = \ monolib_gdiobj.o \ monolib_gdiplus.o \ monolib_graphics.o \ - monolib_gsockmsw.o \ monolib_icon.o \ monolib_imaglist.o \ monolib_minifram.o \ @@ -6237,7 +6269,6 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_2 = \ monolib_gdiobj.o \ monolib_gdiplus.o \ monolib_graphics.o \ - monolib_gsockmsw.o \ monolib_icon.o \ monolib_imaglist.o \ monolib_minifram.o \ @@ -6267,7 +6298,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_2 = \ monolib_fontutil.o \ monolib_utilsx11.o \ monolib_displayx11.o \ - monolib_gsocketiohandler.o \ monolib_icon.o \ monolib_timer.o \ monolib_app.o \ @@ -6868,10 +6898,9 @@ COND_PLATFORM_MACOSX_1___MAC_OSX_SRC_OBJECTS_1 = \ monolib_utilscocoa.o @COND_PLATFORM_MACOSX_1@__MAC_OSX_SRC_OBJECTS_1 = $(COND_PLATFORM_MACOSX_1___MAC_OSX_SRC_OBJECTS_1) @COND_TOOLKIT_COCOA@__LOWLEVEL_SRC_OBJECTS_3 = \ -@COND_TOOLKIT_COCOA@ monolib_gsockosx.o monolib_hid.o monolib_utilsexc_cf.o +@COND_TOOLKIT_COCOA@ monolib_hid.o monolib_utilsexc_cf.o COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS_3 = \ monolib_fontmgrcmn.o \ - monolib_gsocketiohandler.o \ monolib_caret.o \ monolib_colour.o \ monolib_icon.o \ @@ -7054,7 +7083,6 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_3 = \ monolib_gdiobj.o \ monolib_gdiplus.o \ monolib_graphics.o \ - monolib_gsockmsw.o \ monolib_icon.o \ monolib_imaglist.o \ monolib_minifram.o \ @@ -7106,7 +7134,6 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_3 = \ monolib_gdiobj.o \ monolib_gdiplus.o \ monolib_graphics.o \ - monolib_gsockmsw.o \ monolib_icon.o \ monolib_imaglist.o \ monolib_minifram.o \ @@ -7136,7 +7163,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_3 = \ monolib_fontutil.o \ monolib_utilsx11.o \ monolib_displayx11.o \ - monolib_gsocketiohandler.o \ monolib_icon.o \ monolib_timer.o \ monolib_app.o \ @@ -7310,6 +7336,7 @@ COND_PLATFORM_MACOS_1___BASE_PLATFORM_SRC_OBJECTS_2 = \ basedll_thread.o \ basedll_MoreFilesX.o \ basedll_cfstring.o \ + basedll_gsockosx.o \ basedll_stdpaths_cf.o \ basedll_strconv_cf.o \ basedll_utilsexc_base.o \ @@ -7341,6 +7368,7 @@ COND_PLATFORM_OS2_1___BASE_PLATFORM_SRC_OBJECTS_2 = \ basedll_utilsexc.o @COND_PLATFORM_OS2_1@__BASE_PLATFORM_SRC_OBJECTS_2 = $(COND_PLATFORM_OS2_1___BASE_PLATFORM_SRC_OBJECTS_2) COND_PLATFORM_UNIX_1___BASE_PLATFORM_SRC_OBJECTS_2 = \ + basedll_gsocketiohandler.o \ basedll_fdiodispatcher.o \ basedll_selectdispatcher.o \ basedll_appunix.o \ @@ -7378,6 +7406,7 @@ COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS_2 = \ @COND_PLATFORM_WIN32_1@__BASE_PLATFORM_SRC_OBJECTS_2 = $(COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS_2) @COND_TOOLKIT_WINCE@__BASE_WINCE_SRC_OBJECTS_2 = basedll_time.o COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS_2 = \ + basedll_gsocketiohandler.o \ basedll_fdiodispatcher.o \ basedll_selectdispatcher.o \ basedll_appunix.o \ @@ -7393,11 +7422,13 @@ COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS_2 = \ basedll_threadpsx.o \ basedll_timerunx.o \ basedll_cfstring.o \ + basedll_gsockosx.o \ basedll_stdpaths_cf.o \ basedll_strconv_cf.o \ basedll_utilsexc_base.o @COND_TOOLKIT_@__BASE_MACOSX_SRC_OBJECTS_2 = $(COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS_2) COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS_2 = \ + basedll_gsocketiohandler.o \ basedll_fdiodispatcher.o \ basedll_selectdispatcher.o \ basedll_appunix.o \ @@ -7413,11 +7444,13 @@ COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS_2 = \ basedll_threadpsx.o \ basedll_timerunx.o \ basedll_cfstring.o \ + basedll_gsockosx.o \ basedll_stdpaths_cf.o \ basedll_strconv_cf.o \ basedll_utilsexc_base.o @COND_TOOLKIT_COCOA@__BASE_MACOSX_SRC_OBJECTS_2 = $(COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS_2) COND_TOOLKIT_GTK___BASE_MACOSX_SRC_OBJECTS_2 = \ + basedll_gsocketiohandler.o \ basedll_fdiodispatcher.o \ basedll_selectdispatcher.o \ basedll_appunix.o \ @@ -7433,6 +7466,7 @@ COND_TOOLKIT_GTK___BASE_MACOSX_SRC_OBJECTS_2 = \ basedll_threadpsx.o \ basedll_timerunx.o \ basedll_cfstring.o \ + basedll_gsockosx.o \ basedll_stdpaths_cf.o \ basedll_strconv_cf.o \ basedll_utilsexc_base.o @@ -7443,6 +7477,7 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_2 = \ basedll_thread.o \ basedll_MoreFilesX.o \ basedll_cfstring.o \ + basedll_gsockosx.o \ basedll_stdpaths_cf.o \ basedll_strconv_cf.o \ basedll_utilsexc_base.o \ @@ -7457,6 +7492,7 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_2 = \ basedll_timerunx.o @COND_TOOLKIT_MAC@__BASE_MACOSX_SRC_OBJECTS_2 = $(COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_2) COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_2 = \ + basedll_gsocketiohandler.o \ basedll_fdiodispatcher.o \ basedll_selectdispatcher.o \ basedll_appunix.o \ @@ -7472,11 +7508,13 @@ COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_2 = \ basedll_threadpsx.o \ basedll_timerunx.o \ basedll_cfstring.o \ + basedll_gsockosx.o \ basedll_stdpaths_cf.o \ basedll_strconv_cf.o \ basedll_utilsexc_base.o @COND_TOOLKIT_MOTIF@__BASE_MACOSX_SRC_OBJECTS_2 = $(COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_2) COND_TOOLKIT_X11___BASE_MACOSX_SRC_OBJECTS_2 = \ + basedll_gsocketiohandler.o \ basedll_fdiodispatcher.o \ basedll_selectdispatcher.o \ basedll_appunix.o \ @@ -7492,6 +7530,7 @@ COND_TOOLKIT_X11___BASE_MACOSX_SRC_OBJECTS_2 = \ basedll_threadpsx.o \ basedll_timerunx.o \ basedll_cfstring.o \ + basedll_gsockosx.o \ basedll_stdpaths_cf.o \ basedll_strconv_cf.o \ basedll_utilsexc_base.o @@ -7525,6 +7564,7 @@ COND_PLATFORM_MACOS_1___BASE_PLATFORM_SRC_OBJECTS_3 = \ baselib_thread.o \ baselib_MoreFilesX.o \ baselib_cfstring.o \ + baselib_gsockosx.o \ baselib_stdpaths_cf.o \ baselib_strconv_cf.o \ baselib_utilsexc_base.o \ @@ -7556,6 +7596,7 @@ COND_PLATFORM_OS2_1___BASE_PLATFORM_SRC_OBJECTS_3 = \ baselib_utilsexc.o @COND_PLATFORM_OS2_1@__BASE_PLATFORM_SRC_OBJECTS_3 = $(COND_PLATFORM_OS2_1___BASE_PLATFORM_SRC_OBJECTS_3) COND_PLATFORM_UNIX_1___BASE_PLATFORM_SRC_OBJECTS_3 = \ + baselib_gsocketiohandler.o \ baselib_fdiodispatcher.o \ baselib_selectdispatcher.o \ baselib_appunix.o \ @@ -7593,6 +7634,7 @@ COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS_3 = \ @COND_PLATFORM_WIN32_1@__BASE_PLATFORM_SRC_OBJECTS_3 = $(COND_PLATFORM_WIN32_1___BASE_PLATFORM_SRC_OBJECTS_3) @COND_TOOLKIT_WINCE@__BASE_WINCE_SRC_OBJECTS_3 = baselib_time.o COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS_3 = \ + baselib_gsocketiohandler.o \ baselib_fdiodispatcher.o \ baselib_selectdispatcher.o \ baselib_appunix.o \ @@ -7608,11 +7650,13 @@ COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS_3 = \ baselib_threadpsx.o \ baselib_timerunx.o \ baselib_cfstring.o \ + baselib_gsockosx.o \ baselib_stdpaths_cf.o \ baselib_strconv_cf.o \ baselib_utilsexc_base.o @COND_TOOLKIT_@__BASE_MACOSX_SRC_OBJECTS_3 = $(COND_TOOLKIT____BASE_MACOSX_SRC_OBJECTS_3) COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS_3 = \ + baselib_gsocketiohandler.o \ baselib_fdiodispatcher.o \ baselib_selectdispatcher.o \ baselib_appunix.o \ @@ -7628,11 +7672,13 @@ COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS_3 = \ baselib_threadpsx.o \ baselib_timerunx.o \ baselib_cfstring.o \ + baselib_gsockosx.o \ baselib_stdpaths_cf.o \ baselib_strconv_cf.o \ baselib_utilsexc_base.o @COND_TOOLKIT_COCOA@__BASE_MACOSX_SRC_OBJECTS_3 = $(COND_TOOLKIT_COCOA___BASE_MACOSX_SRC_OBJECTS_3) COND_TOOLKIT_GTK___BASE_MACOSX_SRC_OBJECTS_3 = \ + baselib_gsocketiohandler.o \ baselib_fdiodispatcher.o \ baselib_selectdispatcher.o \ baselib_appunix.o \ @@ -7648,6 +7694,7 @@ COND_TOOLKIT_GTK___BASE_MACOSX_SRC_OBJECTS_3 = \ baselib_threadpsx.o \ baselib_timerunx.o \ baselib_cfstring.o \ + baselib_gsockosx.o \ baselib_stdpaths_cf.o \ baselib_strconv_cf.o \ baselib_utilsexc_base.o @@ -7658,6 +7705,7 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_3 = \ baselib_thread.o \ baselib_MoreFilesX.o \ baselib_cfstring.o \ + baselib_gsockosx.o \ baselib_stdpaths_cf.o \ baselib_strconv_cf.o \ baselib_utilsexc_base.o \ @@ -7672,6 +7720,7 @@ COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_3 = \ baselib_timerunx.o @COND_TOOLKIT_MAC@__BASE_MACOSX_SRC_OBJECTS_3 = $(COND_TOOLKIT_MAC___BASE_MACOSX_SRC_OBJECTS_3) COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_3 = \ + baselib_gsocketiohandler.o \ baselib_fdiodispatcher.o \ baselib_selectdispatcher.o \ baselib_appunix.o \ @@ -7687,11 +7736,13 @@ COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_3 = \ baselib_threadpsx.o \ baselib_timerunx.o \ baselib_cfstring.o \ + baselib_gsockosx.o \ baselib_stdpaths_cf.o \ baselib_strconv_cf.o \ baselib_utilsexc_base.o @COND_TOOLKIT_MOTIF@__BASE_MACOSX_SRC_OBJECTS_3 = $(COND_TOOLKIT_MOTIF___BASE_MACOSX_SRC_OBJECTS_3) COND_TOOLKIT_X11___BASE_MACOSX_SRC_OBJECTS_3 = \ + baselib_gsocketiohandler.o \ baselib_fdiodispatcher.o \ baselib_selectdispatcher.o \ baselib_appunix.o \ @@ -7707,6 +7758,7 @@ COND_TOOLKIT_X11___BASE_MACOSX_SRC_OBJECTS_3 = \ baselib_threadpsx.o \ baselib_timerunx.o \ baselib_cfstring.o \ + baselib_gsockosx.o \ baselib_stdpaths_cf.o \ baselib_strconv_cf.o \ baselib_utilsexc_base.o @@ -7777,9 +7829,12 @@ COND_USE_SOSYMLINKS_1___netdll___so_symlinks_uninst_cmd = rm -f \ @COND_PLATFORM_MACOS_1@__NET_PLATFORM_SRC_OBJECTS_2 = netdll_gsocket.o @COND_PLATFORM_OS2_1@__NET_PLATFORM_SRC_OBJECTS_2 = netdll_gsocket.o @COND_PLATFORM_UNIX_1@__NET_PLATFORM_SRC_OBJECTS_2 = netdll_gsocket.o -@COND_PLATFORM_WIN32_1@__NET_PLATFORM_SRC_OBJECTS_2 \ -@COND_PLATFORM_WIN32_1@ = netdll_gsocket.o netdll_urlmsw.o \ -@COND_PLATFORM_WIN32_1@ $(__NET_WINCE_SRC_OBJECTS_2) +COND_PLATFORM_WIN32_1___NET_PLATFORM_SRC_OBJECTS_2 = \ + netdll_gsocket.o \ + netdll_gsockmsw.o \ + netdll_urlmsw.o \ + $(__NET_WINCE_SRC_OBJECTS_2) +@COND_PLATFORM_WIN32_1@__NET_PLATFORM_SRC_OBJECTS_2 = $(COND_PLATFORM_WIN32_1___NET_PLATFORM_SRC_OBJECTS_2) @COND_TOOLKIT_WINCE@__NET_WINCE_SRC_OBJECTS_2 = netdll_net.o COND_MONOLITHIC_0_SHARED_0___netlib___depname = \ $(LIBDIRNAME)/$(LIBPREFIX)wx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net-$(WX_RELEASE)$(HOST_SUFFIX)$(LIBEXT) @@ -7795,9 +7850,12 @@ COND_MONOLITHIC_0_SHARED_0___netlib___depname = \ @COND_PLATFORM_MACOS_1@__NET_PLATFORM_SRC_OBJECTS_3 = netlib_gsocket.o @COND_PLATFORM_OS2_1@__NET_PLATFORM_SRC_OBJECTS_3 = netlib_gsocket.o @COND_PLATFORM_UNIX_1@__NET_PLATFORM_SRC_OBJECTS_3 = netlib_gsocket.o -@COND_PLATFORM_WIN32_1@__NET_PLATFORM_SRC_OBJECTS_3 \ -@COND_PLATFORM_WIN32_1@ = netlib_gsocket.o netlib_urlmsw.o \ -@COND_PLATFORM_WIN32_1@ $(__NET_WINCE_SRC_OBJECTS_3) +COND_PLATFORM_WIN32_1___NET_PLATFORM_SRC_OBJECTS_3 = \ + netlib_gsocket.o \ + netlib_gsockmsw.o \ + netlib_urlmsw.o \ + $(__NET_WINCE_SRC_OBJECTS_3) +@COND_PLATFORM_WIN32_1@__NET_PLATFORM_SRC_OBJECTS_3 = $(COND_PLATFORM_WIN32_1___NET_PLATFORM_SRC_OBJECTS_3) @COND_TOOLKIT_WINCE@__NET_WINCE_SRC_OBJECTS_3 = netlib_net.o @COND_SHARED_1@____wxnet_namedll_DEP = $(__netdll___depname) @COND_SHARED_0@____wxnet_namelib_DEP = $(__netlib___depname) @@ -8174,10 +8232,9 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2 = \ coredll_vscroll.o @COND_USE_GUI_1_WXUNIV_1@__CORE_SRC_OBJECTS_2 = $(COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_2) @COND_TOOLKIT_COCOA@__LOWLEVEL_SRC_OBJECTS_4 = \ -@COND_TOOLKIT_COCOA@ coredll_gsockosx.o coredll_hid.o coredll_utilsexc_cf.o +@COND_TOOLKIT_COCOA@ coredll_hid.o coredll_utilsexc_cf.o COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS_4 = \ coredll_fontmgrcmn.o \ - coredll_gsocketiohandler.o \ coredll_caret.o \ coredll_colour.o \ coredll_icon.o \ @@ -8360,7 +8417,6 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_4 = \ coredll_gdiobj.o \ coredll_gdiplus.o \ coredll_graphics.o \ - coredll_gsockmsw.o \ coredll_icon.o \ coredll_imaglist.o \ coredll_minifram.o \ @@ -8412,7 +8468,6 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_4 = \ coredll_gdiobj.o \ coredll_gdiplus.o \ coredll_graphics.o \ - coredll_gsockmsw.o \ coredll_icon.o \ coredll_imaglist.o \ coredll_minifram.o \ @@ -8442,7 +8497,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_4 = \ coredll_fontutil.o \ coredll_utilsx11.o \ coredll_displayx11.o \ - coredll_gsocketiohandler.o \ coredll_icon.o \ coredll_timer.o \ coredll_app.o \ @@ -9043,10 +9097,9 @@ COND_PLATFORM_MACOSX_1___MAC_OSX_SRC_OBJECTS_2 = \ coredll_utilscocoa.o @COND_PLATFORM_MACOSX_1@__MAC_OSX_SRC_OBJECTS_2 = $(COND_PLATFORM_MACOSX_1___MAC_OSX_SRC_OBJECTS_2) @COND_TOOLKIT_COCOA@__LOWLEVEL_SRC_OBJECTS_5 = \ -@COND_TOOLKIT_COCOA@ coredll_gsockosx.o coredll_hid.o coredll_utilsexc_cf.o +@COND_TOOLKIT_COCOA@ coredll_hid.o coredll_utilsexc_cf.o COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS_5 = \ coredll_fontmgrcmn.o \ - coredll_gsocketiohandler.o \ coredll_caret.o \ coredll_colour.o \ coredll_icon.o \ @@ -9229,7 +9282,6 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_5 = \ coredll_gdiobj.o \ coredll_gdiplus.o \ coredll_graphics.o \ - coredll_gsockmsw.o \ coredll_icon.o \ coredll_imaglist.o \ coredll_minifram.o \ @@ -9281,7 +9333,6 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_5 = \ coredll_gdiobj.o \ coredll_gdiplus.o \ coredll_graphics.o \ - coredll_gsockmsw.o \ coredll_icon.o \ coredll_imaglist.o \ coredll_minifram.o \ @@ -9311,7 +9362,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_5 = \ coredll_fontutil.o \ coredll_utilsx11.o \ coredll_displayx11.o \ - coredll_gsocketiohandler.o \ coredll_icon.o \ coredll_timer.o \ coredll_app.o \ @@ -9674,10 +9724,9 @@ COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3 = \ corelib_vscroll.o @COND_USE_GUI_1_WXUNIV_1@__CORE_SRC_OBJECTS_3 = $(COND_USE_GUI_1_WXUNIV_1___CORE_SRC_OBJECTS_3) @COND_TOOLKIT_COCOA@__LOWLEVEL_SRC_OBJECTS_6 = \ -@COND_TOOLKIT_COCOA@ corelib_gsockosx.o corelib_hid.o corelib_utilsexc_cf.o +@COND_TOOLKIT_COCOA@ corelib_hid.o corelib_utilsexc_cf.o COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS_6 = \ corelib_fontmgrcmn.o \ - corelib_gsocketiohandler.o \ corelib_caret.o \ corelib_colour.o \ corelib_icon.o \ @@ -9860,7 +9909,6 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_6 = \ corelib_gdiobj.o \ corelib_gdiplus.o \ corelib_graphics.o \ - corelib_gsockmsw.o \ corelib_icon.o \ corelib_imaglist.o \ corelib_minifram.o \ @@ -9912,7 +9960,6 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_6 = \ corelib_gdiobj.o \ corelib_gdiplus.o \ corelib_graphics.o \ - corelib_gsockmsw.o \ corelib_icon.o \ corelib_imaglist.o \ corelib_minifram.o \ @@ -9942,7 +9989,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_6 = \ corelib_fontutil.o \ corelib_utilsx11.o \ corelib_displayx11.o \ - corelib_gsocketiohandler.o \ corelib_icon.o \ corelib_timer.o \ corelib_app.o \ @@ -10543,10 +10589,9 @@ COND_PLATFORM_MACOSX_1___MAC_OSX_SRC_OBJECTS_3 = \ corelib_utilscocoa.o @COND_PLATFORM_MACOSX_1@__MAC_OSX_SRC_OBJECTS_3 = $(COND_PLATFORM_MACOSX_1___MAC_OSX_SRC_OBJECTS_3) @COND_TOOLKIT_COCOA@__LOWLEVEL_SRC_OBJECTS_7 = \ -@COND_TOOLKIT_COCOA@ corelib_gsockosx.o corelib_hid.o corelib_utilsexc_cf.o +@COND_TOOLKIT_COCOA@ corelib_hid.o corelib_utilsexc_cf.o COND_TOOLKIT_DFB___LOWLEVEL_SRC_OBJECTS_7 = \ corelib_fontmgrcmn.o \ - corelib_gsocketiohandler.o \ corelib_caret.o \ corelib_colour.o \ corelib_icon.o \ @@ -10729,7 +10774,6 @@ COND_TOOLKIT_MSW___LOWLEVEL_SRC_OBJECTS_7 = \ corelib_gdiobj.o \ corelib_gdiplus.o \ corelib_graphics.o \ - corelib_gsockmsw.o \ corelib_icon.o \ corelib_imaglist.o \ corelib_minifram.o \ @@ -10781,7 +10825,6 @@ COND_TOOLKIT_WINCE___LOWLEVEL_SRC_OBJECTS_7 = \ corelib_gdiobj.o \ corelib_gdiplus.o \ corelib_graphics.o \ - corelib_gsockmsw.o \ corelib_icon.o \ corelib_imaglist.o \ corelib_minifram.o \ @@ -10811,7 +10854,6 @@ COND_TOOLKIT_X11___LOWLEVEL_SRC_OBJECTS_7 = \ corelib_fontutil.o \ corelib_utilsx11.o \ corelib_displayx11.o \ - corelib_gsocketiohandler.o \ corelib_icon.o \ corelib_timer.o \ corelib_app.o \ @@ -11714,8 +11756,7 @@ COND_WITH_PLUGIN_SDL_1___sound_sdl___depname = \ @COND_SHARED_0@____SHARED = @COND_SHARED_1@____SHARED = $(PIC_FLAG) @COND_PLATFORM_MACOSX_1@__MAC_LOWLEVEL_SRC_OBJECTS \ -@COND_PLATFORM_MACOSX_1@ = monodll_gsockosx.o monodll_hid.o \ -@COND_PLATFORM_MACOSX_1@ monodll_utilsexc_cf.o +@COND_PLATFORM_MACOSX_1@ = monodll_hid.o monodll_utilsexc_cf.o COND_PLATFORM_UNIX_1_TOOLKIT_MGL___ADVANCED_PLATFORM_SRC_OBJECTS = \ monodll_taskbarcmn.o \ monodll_joystick.o \ @@ -11790,8 +11831,7 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS = \ monodll_taskbarx11.o @COND_TOOLKIT_X11@__ADVANCED_PLATFORM_SRC_OBJECTS = $(COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS) @COND_PLATFORM_MACOSX_1@__MAC_LOWLEVEL_SRC_OBJECTS_0 \ -@COND_PLATFORM_MACOSX_1@ = monolib_gsockosx.o monolib_hid.o \ -@COND_PLATFORM_MACOSX_1@ monolib_utilsexc_cf.o +@COND_PLATFORM_MACOSX_1@ = monolib_hid.o monolib_utilsexc_cf.o COND_PLATFORM_UNIX_1_TOOLKIT_MGL___ADVANCED_PLATFORM_SRC_OBJECTS_0 = \ monolib_taskbarcmn.o \ monolib_joystick.o \ @@ -11866,11 +11906,9 @@ COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_0 = \ monolib_taskbarx11.o @COND_TOOLKIT_X11@__ADVANCED_PLATFORM_SRC_OBJECTS_0 = $(COND_TOOLKIT_X11___ADVANCED_PLATFORM_SRC_OBJECTS_0) @COND_PLATFORM_MACOSX_1@__MAC_LOWLEVEL_SRC_OBJECTS_8 \ -@COND_PLATFORM_MACOSX_1@ = coredll_gsockosx.o coredll_hid.o \ -@COND_PLATFORM_MACOSX_1@ coredll_utilsexc_cf.o +@COND_PLATFORM_MACOSX_1@ = coredll_hid.o coredll_utilsexc_cf.o @COND_PLATFORM_MACOSX_1@__MAC_LOWLEVEL_SRC_OBJECTS_9 \ -@COND_PLATFORM_MACOSX_1@ = corelib_gsockosx.o corelib_hid.o \ -@COND_PLATFORM_MACOSX_1@ corelib_utilsexc_cf.o +@COND_PLATFORM_MACOSX_1@ = corelib_hid.o corelib_utilsexc_cf.o @COND_PLATFORM_UNIX_1_TOOLKIT_MGL@__ADVANCED_PLATFORM_SRC_OBJECTS_8 \ @COND_PLATFORM_UNIX_1_TOOLKIT_MGL@ = advdll_taskbarcmn.o advdll_joystick.o \ @COND_PLATFORM_UNIX_1_TOOLKIT_MGL@ advdll_sound.o advdll_taskbarx11.o @@ -13847,6 +13885,9 @@ monodll_socket.o: $(srcdir)/src/common/socket.cpp $(MONODLL_ODEP) monodll_url.o: $(srcdir)/src/common/url.cpp $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/url.cpp +monodll_gsockmsw.o: $(srcdir)/src/msw/gsockmsw.cpp $(MONODLL_ODEP) + $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/gsockmsw.cpp + monodll_urlmsw.o: $(srcdir)/src/msw/urlmsw.cpp $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/urlmsw.cpp @@ -14372,6 +14413,24 @@ monodll_xtixml.o: $(srcdir)/src/common/xtixml.cpp $(MONODLL_ODEP) monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/unix/sound_sdl.cpp +@COND_PLATFORM_UNIX_1@monodll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONODLL_ODEP) +@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@monodll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@monodll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@monodll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@monodll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_@monodll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + @COND_PLATFORM_UNIX_1@monodll_fdiodispatcher.o: $(srcdir)/src/common/fdiodispatcher.cpp $(MONODLL_ODEP) @COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/fdiodispatcher.cpp @@ -14813,6 +14872,27 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOS_1@monodll_cfstring.o: $(srcdir)/src/mac/corefoundation/cfstring.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOS_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/cfstring.cpp +@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@monodll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@monodll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@monodll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@monodll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@monodll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_@monodll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOS_1@monodll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONODLL_ODEP) +@COND_PLATFORM_MACOS_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@monodll_stdpaths_cf.o: $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp @@ -15947,12 +16027,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@monodll_graphics.o: $(srcdir)/src/mac/carbon/graphics.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/carbon/graphics.cpp -@COND_TOOLKIT_MSW_USE_GUI_1@monodll_gsockmsw.o: $(srcdir)/src/msw/gsockmsw.cpp $(MONODLL_ODEP) -@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/gsockmsw.cpp - -@COND_TOOLKIT_WINCE_USE_GUI_1@monodll_gsockmsw.o: $(srcdir)/src/msw/gsockmsw.cpp $(MONODLL_ODEP) -@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/gsockmsw.cpp - @COND_TOOLKIT_MSW_USE_GUI_1@monodll_dropsrc.o: $(srcdir)/src/msw/ole/dropsrc.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/dropsrc.cpp @@ -16016,12 +16090,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monodll_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(MONODLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp -@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@monodll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONODLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp - -@COND_TOOLKIT_COCOA_USE_GUI_1@monodll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONODLL_ODEP) -@COND_TOOLKIT_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp - @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@monodll_hid.o: $(srcdir)/src/mac/corefoundation/hid.cpp $(MONODLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/hid.cpp @@ -16034,12 +16102,6 @@ monodll_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONODLL_ODEP) @COND_TOOLKIT_COCOA_USE_GUI_1@monodll_utilsexc_cf.o: $(srcdir)/src/mac/corefoundation/utilsexc_cf.cpp $(MONODLL_ODEP) @COND_TOOLKIT_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/utilsexc_cf.cpp -@COND_TOOLKIT_X11_USE_GUI_1@monodll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONODLL_ODEP) -@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp - -@COND_TOOLKIT_DFB_USE_GUI_1@monodll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONODLL_ODEP) -@COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp - @COND_TOOLKIT_X11_USE_GUI_1@monodll_nanox.o: $(srcdir)/src/x11/nanox.c $(MONODLL_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@ $(CCC) -c -o $@ $(MONODLL_CFLAGS) $(srcdir)/src/x11/nanox.c @@ -18329,6 +18391,9 @@ monolib_socket.o: $(srcdir)/src/common/socket.cpp $(MONOLIB_ODEP) monolib_url.o: $(srcdir)/src/common/url.cpp $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/url.cpp +monolib_gsockmsw.o: $(srcdir)/src/msw/gsockmsw.cpp $(MONOLIB_ODEP) + $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/gsockmsw.cpp + monolib_urlmsw.o: $(srcdir)/src/msw/urlmsw.cpp $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/urlmsw.cpp @@ -18854,6 +18919,24 @@ monolib_xtixml.o: $(srcdir)/src/common/xtixml.cpp $(MONOLIB_ODEP) monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/unix/sound_sdl.cpp +@COND_PLATFORM_UNIX_1@monolib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@monolib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@monolib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@monolib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@monolib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_@monolib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + @COND_PLATFORM_UNIX_1@monolib_fdiodispatcher.o: $(srcdir)/src/common/fdiodispatcher.cpp $(MONOLIB_ODEP) @COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/fdiodispatcher.cpp @@ -19295,6 +19378,27 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOS_1@monolib_cfstring.o: $(srcdir)/src/mac/corefoundation/cfstring.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOS_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/cfstring.cpp +@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@monolib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@monolib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@monolib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@monolib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@monolib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_@monolib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOS_1@monolib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONOLIB_ODEP) +@COND_PLATFORM_MACOS_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@monolib_stdpaths_cf.o: $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp @@ -20429,12 +20533,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@monolib_graphics.o: $(srcdir)/src/mac/carbon/graphics.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/carbon/graphics.cpp -@COND_TOOLKIT_MSW_USE_GUI_1@monolib_gsockmsw.o: $(srcdir)/src/msw/gsockmsw.cpp $(MONOLIB_ODEP) -@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/gsockmsw.cpp - -@COND_TOOLKIT_WINCE_USE_GUI_1@monolib_gsockmsw.o: $(srcdir)/src/msw/gsockmsw.cpp $(MONOLIB_ODEP) -@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/gsockmsw.cpp - @COND_TOOLKIT_MSW_USE_GUI_1@monolib_dropsrc.o: $(srcdir)/src/msw/ole/dropsrc.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/dropsrc.cpp @@ -20498,12 +20596,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@monolib_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp -@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@monolib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONOLIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp - -@COND_TOOLKIT_COCOA_USE_GUI_1@monolib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(MONOLIB_ODEP) -@COND_TOOLKIT_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp - @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@monolib_hid.o: $(srcdir)/src/mac/corefoundation/hid.cpp $(MONOLIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/hid.cpp @@ -20516,12 +20608,6 @@ monolib_sound_sdl.o: $(srcdir)/src/unix/sound_sdl.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_COCOA_USE_GUI_1@monolib_utilsexc_cf.o: $(srcdir)/src/mac/corefoundation/utilsexc_cf.cpp $(MONOLIB_ODEP) @COND_TOOLKIT_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/utilsexc_cf.cpp -@COND_TOOLKIT_X11_USE_GUI_1@monolib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONOLIB_ODEP) -@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp - -@COND_TOOLKIT_DFB_USE_GUI_1@monolib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(MONOLIB_ODEP) -@COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp - @COND_TOOLKIT_X11_USE_GUI_1@monolib_nanox.o: $(srcdir)/src/x11/nanox.c $(MONOLIB_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@ $(CCC) -c -o $@ $(MONOLIB_CFLAGS) $(srcdir)/src/x11/nanox.c @@ -22790,6 +22876,24 @@ basedll_volume.o: $(srcdir)/src/msw/volume.cpp $(BASEDLL_ODEP) basedll_uma.o: $(srcdir)/src/mac/carbon/uma.cpp $(BASEDLL_ODEP) $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/mac/carbon/uma.cpp +@COND_PLATFORM_UNIX_1@basedll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(BASEDLL_ODEP) +@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@basedll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(BASEDLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@basedll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(BASEDLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@basedll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(BASEDLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@basedll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(BASEDLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_@basedll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(BASEDLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + @COND_PLATFORM_UNIX_1@basedll_fdiodispatcher.o: $(srcdir)/src/common/fdiodispatcher.cpp $(BASEDLL_ODEP) @COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/common/fdiodispatcher.cpp @@ -23183,6 +23287,27 @@ basedll_uma.o: $(srcdir)/src/mac/carbon/uma.cpp $(BASEDLL_ODEP) @COND_PLATFORM_MACOS_1@basedll_cfstring.o: $(srcdir)/src/mac/corefoundation/cfstring.cpp $(BASEDLL_ODEP) @COND_PLATFORM_MACOS_1@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/cfstring.cpp +@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@basedll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(BASEDLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@basedll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(BASEDLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@basedll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(BASEDLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@basedll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(BASEDLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@basedll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(BASEDLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_@basedll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(BASEDLL_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOS_1@basedll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(BASEDLL_ODEP) +@COND_PLATFORM_MACOS_1@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@basedll_stdpaths_cf.o: $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp $(BASEDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(BASEDLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp @@ -23564,6 +23689,24 @@ baselib_volume.o: $(srcdir)/src/msw/volume.cpp $(BASELIB_ODEP) baselib_uma.o: $(srcdir)/src/mac/carbon/uma.cpp $(BASELIB_ODEP) $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/mac/carbon/uma.cpp +@COND_PLATFORM_UNIX_1@baselib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(BASELIB_ODEP) +@COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@baselib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(BASELIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@baselib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(BASELIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@baselib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(BASELIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@baselib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(BASELIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_@baselib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(BASELIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp + @COND_PLATFORM_UNIX_1@baselib_fdiodispatcher.o: $(srcdir)/src/common/fdiodispatcher.cpp $(BASELIB_ODEP) @COND_PLATFORM_UNIX_1@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/common/fdiodispatcher.cpp @@ -23957,6 +24100,27 @@ baselib_uma.o: $(srcdir)/src/mac/carbon/uma.cpp $(BASELIB_ODEP) @COND_PLATFORM_MACOS_1@baselib_cfstring.o: $(srcdir)/src/mac/corefoundation/cfstring.cpp $(BASELIB_ODEP) @COND_PLATFORM_MACOS_1@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/cfstring.cpp +@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@baselib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(BASELIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@baselib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(BASELIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_COCOA@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@baselib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(BASELIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_GTK@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@baselib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(BASELIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_X11@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@baselib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(BASELIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_MOTIF@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOSX_1_TOOLKIT_@baselib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(BASELIB_ODEP) +@COND_PLATFORM_MACOSX_1_TOOLKIT_@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + +@COND_PLATFORM_MACOS_1@baselib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(BASELIB_ODEP) +@COND_PLATFORM_MACOS_1@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp + @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@baselib_stdpaths_cf.o: $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp $(BASELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC@ $(CXXC) -c -o $@ $(BASELIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/stdpaths_cf.cpp @@ -24059,6 +24223,9 @@ netdll_socket.o: $(srcdir)/src/common/socket.cpp $(NETDLL_ODEP) netdll_url.o: $(srcdir)/src/common/url.cpp $(NETDLL_ODEP) $(CXXC) -c -o $@ $(NETDLL_CXXFLAGS) $(srcdir)/src/common/url.cpp +netdll_gsockmsw.o: $(srcdir)/src/msw/gsockmsw.cpp $(NETDLL_ODEP) + $(CXXC) -c -o $@ $(NETDLL_CXXFLAGS) $(srcdir)/src/msw/gsockmsw.cpp + netdll_urlmsw.o: $(srcdir)/src/msw/urlmsw.cpp $(NETDLL_ODEP) $(CXXC) -c -o $@ $(NETDLL_CXXFLAGS) $(srcdir)/src/msw/urlmsw.cpp @@ -24110,6 +24277,9 @@ netlib_socket.o: $(srcdir)/src/common/socket.cpp $(NETLIB_ODEP) netlib_url.o: $(srcdir)/src/common/url.cpp $(NETLIB_ODEP) $(CXXC) -c -o $@ $(NETLIB_CXXFLAGS) $(srcdir)/src/common/url.cpp +netlib_gsockmsw.o: $(srcdir)/src/msw/gsockmsw.cpp $(NETLIB_ODEP) + $(CXXC) -c -o $@ $(NETLIB_CXXFLAGS) $(srcdir)/src/msw/gsockmsw.cpp + netlib_urlmsw.o: $(srcdir)/src/msw/urlmsw.cpp $(NETLIB_ODEP) $(CXXC) -c -o $@ $(NETLIB_CXXFLAGS) $(srcdir)/src/msw/urlmsw.cpp @@ -25466,12 +25636,6 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@coredll_graphics.o: $(srcdir)/src/mac/carbon/graphics.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/mac/carbon/graphics.cpp -@COND_TOOLKIT_MSW_USE_GUI_1@coredll_gsockmsw.o: $(srcdir)/src/msw/gsockmsw.cpp $(COREDLL_ODEP) -@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/gsockmsw.cpp - -@COND_TOOLKIT_WINCE_USE_GUI_1@coredll_gsockmsw.o: $(srcdir)/src/msw/gsockmsw.cpp $(COREDLL_ODEP) -@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/gsockmsw.cpp - @COND_TOOLKIT_MSW_USE_GUI_1@coredll_dropsrc.o: $(srcdir)/src/msw/ole/dropsrc.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/dropsrc.cpp @@ -25535,12 +25699,6 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@coredll_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(COREDLL_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp -@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@coredll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(COREDLL_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp - -@COND_TOOLKIT_COCOA_USE_GUI_1@coredll_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(COREDLL_ODEP) -@COND_TOOLKIT_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp - @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@coredll_hid.o: $(srcdir)/src/mac/corefoundation/hid.cpp $(COREDLL_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/hid.cpp @@ -25553,12 +25711,6 @@ coredll_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(COREDLL_ODEP) @COND_TOOLKIT_COCOA_USE_GUI_1@coredll_utilsexc_cf.o: $(srcdir)/src/mac/corefoundation/utilsexc_cf.cpp $(COREDLL_ODEP) @COND_TOOLKIT_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/mac/corefoundation/utilsexc_cf.cpp -@COND_TOOLKIT_X11_USE_GUI_1@coredll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(COREDLL_ODEP) -@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp - -@COND_TOOLKIT_DFB_USE_GUI_1@coredll_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(COREDLL_ODEP) -@COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp - @COND_TOOLKIT_X11_USE_GUI_1@coredll_nanox.o: $(srcdir)/src/x11/nanox.c $(COREDLL_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@ $(CCC) -c -o $@ $(COREDLL_CFLAGS) $(srcdir)/src/x11/nanox.c @@ -28544,12 +28696,6 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@corelib_graphics.o: $(srcdir)/src/mac/carbon/graphics.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MAC_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/mac/carbon/graphics.cpp -@COND_TOOLKIT_MSW_USE_GUI_1@corelib_gsockmsw.o: $(srcdir)/src/msw/gsockmsw.cpp $(CORELIB_ODEP) -@COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/gsockmsw.cpp - -@COND_TOOLKIT_WINCE_USE_GUI_1@corelib_gsockmsw.o: $(srcdir)/src/msw/gsockmsw.cpp $(CORELIB_ODEP) -@COND_TOOLKIT_WINCE_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/gsockmsw.cpp - @COND_TOOLKIT_MSW_USE_GUI_1@corelib_dropsrc.o: $(srcdir)/src/msw/ole/dropsrc.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/dropsrc.cpp @@ -28613,12 +28759,6 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@corelib_uuid.o: $(srcdir)/src/msw/ole/uuid.cpp $(CORELIB_ODEP) @COND_TOOLKIT_MSW_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/ole/uuid.cpp -@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@corelib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(CORELIB_ODEP) -@COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp - -@COND_TOOLKIT_COCOA_USE_GUI_1@corelib_gsockosx.o: $(srcdir)/src/mac/corefoundation/gsockosx.cpp $(CORELIB_ODEP) -@COND_TOOLKIT_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/gsockosx.cpp - @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@corelib_hid.o: $(srcdir)/src/mac/corefoundation/hid.cpp $(CORELIB_ODEP) @COND_PLATFORM_MACOSX_1_TOOLKIT_MAC_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/hid.cpp @@ -28631,12 +28771,6 @@ corelib_win32.o: $(srcdir)/src/univ/themes/win32.cpp $(CORELIB_ODEP) @COND_TOOLKIT_COCOA_USE_GUI_1@corelib_utilsexc_cf.o: $(srcdir)/src/mac/corefoundation/utilsexc_cf.cpp $(CORELIB_ODEP) @COND_TOOLKIT_COCOA_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/mac/corefoundation/utilsexc_cf.cpp -@COND_TOOLKIT_X11_USE_GUI_1@corelib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(CORELIB_ODEP) -@COND_TOOLKIT_X11_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp - -@COND_TOOLKIT_DFB_USE_GUI_1@corelib_gsocketiohandler.o: $(srcdir)/src/common/gsocketiohandler.cpp $(CORELIB_ODEP) -@COND_TOOLKIT_DFB_USE_GUI_1@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/common/gsocketiohandler.cpp - @COND_TOOLKIT_X11_USE_GUI_1@corelib_nanox.o: $(srcdir)/src/x11/nanox.c $(CORELIB_ODEP) @COND_TOOLKIT_X11_USE_GUI_1@ $(CCC) -c -o $@ $(CORELIB_CFLAGS) $(srcdir)/src/x11/nanox.c diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index dd791fb72c..492eaed1fd 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -54,6 +54,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! + src/common/gsocketiohandler.cpp src/common/fdiodispatcher.cpp src/common/selectdispatcher.cpp src/unix/appunix.cpp @@ -74,6 +75,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/private/fdiodispatcher.h + wx/private/gsocketiohandler.h wx/private/selectdispatcher.h wx/unix/app.h wx/unix/apptbase.h @@ -155,6 +157,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/mac/corefoundation/cfstring.cpp + src/mac/corefoundation/gsockosx.cpp src/mac/corefoundation/stdpaths_cf.cpp src/mac/corefoundation/strconv_cf.cpp src/mac/corefoundation/utilsexc_base.cpp @@ -549,6 +552,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/msw/gsocket.cpp + src/msw/gsockmsw.cpp src/msw/urlmsw.cpp @@ -1482,7 +1486,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! $(XWIN_LOWLEVEL_SRC) - src/common/gsocketiohandler.cpp src/generic/icon.cpp src/generic/timer.cpp src/x11/app.cpp @@ -1577,7 +1580,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/msw/gdiobj.cpp src/msw/gdiplus.cpp src/msw/graphics.cpp - src/msw/gsockmsw.cpp src/msw/icon.cpp src/msw/imaglist.cpp src/msw/minifram.cpp @@ -1906,7 +1908,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/common/fontmgrcmn.cpp - src/common/gsocketiohandler.cpp src/generic/caret.cpp src/generic/colour.cpp src/generic/icon.cpp @@ -2148,7 +2149,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! - src/mac/corefoundation/gsockosx.cpp src/mac/corefoundation/hid.cpp src/mac/corefoundation/utilsexc_cf.cpp @@ -2460,7 +2460,6 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! - src/mac/corefoundation/gsockosx.cpp src/mac/corefoundation/hid.cpp src/mac/corefoundation/utilsexc_cf.cpp diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index ed3d877eb1..123206e3d9 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -417,6 +417,7 @@ MONODLL_OBJECTS = \ $(OBJS)\monodll_socket.obj \ $(OBJS)\monodll_url.obj \ $(OBJS)\monodll_gsocket.obj \ + $(OBJS)\monodll_gsockmsw.obj \ $(OBJS)\monodll_urlmsw.obj \ $(____MONOLIB_GUI_SRC_FILENAMES_OBJECTS) \ $(OBJS)\monodll_xml.obj \ @@ -553,6 +554,7 @@ MONOLIB_OBJECTS = \ $(OBJS)\monolib_socket.obj \ $(OBJS)\monolib_url.obj \ $(OBJS)\monolib_gsocket.obj \ + $(OBJS)\monolib_gsockmsw.obj \ $(OBJS)\monolib_urlmsw.obj \ $(____MONOLIB_GUI_SRC_FILENAMES_1_OBJECTS) \ $(OBJS)\monolib_xml.obj \ @@ -814,6 +816,7 @@ NETDLL_OBJECTS = \ $(OBJS)\netdll_socket.obj \ $(OBJS)\netdll_url.obj \ $(OBJS)\netdll_gsocket.obj \ + $(OBJS)\netdll_gsockmsw.obj \ $(OBJS)\netdll_urlmsw.obj NETLIB_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \ $(__OPTIMIZEFLAG) $(__THREADSFLAG) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \ @@ -836,6 +839,7 @@ NETLIB_OBJECTS = \ $(OBJS)\netlib_socket.obj \ $(OBJS)\netlib_url.obj \ $(OBJS)\netlib_gsocket.obj \ + $(OBJS)\netlib_gsockmsw.obj \ $(OBJS)\netlib_urlmsw.obj COREDLL_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \ $(__OPTIMIZEFLAG) $(__THREADSFLAG) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \ @@ -1490,7 +1494,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gdiobj.obj \ $(OBJS)\monodll_gdiplus.obj \ $(OBJS)\monodll_graphics.obj \ - $(OBJS)\monodll_gsockmsw.obj \ $(OBJS)\monodll_icon.obj \ $(OBJS)\monodll_imaglist.obj \ $(OBJS)\monodll_minifram.obj \ @@ -1719,7 +1722,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gdiobj.obj \ $(OBJS)\monodll_gdiplus.obj \ $(OBJS)\monodll_graphics.obj \ - $(OBJS)\monodll_gsockmsw.obj \ $(OBJS)\monodll_icon.obj \ $(OBJS)\monodll_imaglist.obj \ $(OBJS)\monodll_minifram.obj \ @@ -2133,7 +2135,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gdiobj.obj \ $(OBJS)\monolib_gdiplus.obj \ $(OBJS)\monolib_graphics.obj \ - $(OBJS)\monolib_gsockmsw.obj \ $(OBJS)\monolib_icon.obj \ $(OBJS)\monolib_imaglist.obj \ $(OBJS)\monolib_minifram.obj \ @@ -2362,7 +2363,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gdiobj.obj \ $(OBJS)\monolib_gdiplus.obj \ $(OBJS)\monolib_graphics.obj \ - $(OBJS)\monolib_gsockmsw.obj \ $(OBJS)\monolib_icon.obj \ $(OBJS)\monolib_imaglist.obj \ $(OBJS)\monolib_minifram.obj \ @@ -2691,7 +2691,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_gdiobj.obj \ $(OBJS)\coredll_gdiplus.obj \ $(OBJS)\coredll_graphics.obj \ - $(OBJS)\coredll_gsockmsw.obj \ $(OBJS)\coredll_icon.obj \ $(OBJS)\coredll_imaglist.obj \ $(OBJS)\coredll_minifram.obj \ @@ -2920,7 +2919,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_gdiobj.obj \ $(OBJS)\coredll_gdiplus.obj \ $(OBJS)\coredll_graphics.obj \ - $(OBJS)\coredll_gsockmsw.obj \ $(OBJS)\coredll_icon.obj \ $(OBJS)\coredll_imaglist.obj \ $(OBJS)\coredll_minifram.obj \ @@ -3155,7 +3153,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_gdiobj.obj \ $(OBJS)\corelib_gdiplus.obj \ $(OBJS)\corelib_graphics.obj \ - $(OBJS)\corelib_gsockmsw.obj \ $(OBJS)\corelib_icon.obj \ $(OBJS)\corelib_imaglist.obj \ $(OBJS)\corelib_minifram.obj \ @@ -3384,7 +3381,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_gdiobj.obj \ $(OBJS)\corelib_gdiplus.obj \ $(OBJS)\corelib_graphics.obj \ - $(OBJS)\corelib_gsockmsw.obj \ $(OBJS)\corelib_icon.obj \ $(OBJS)\corelib_imaglist.obj \ $(OBJS)\corelib_minifram.obj \ @@ -5503,6 +5499,9 @@ $(OBJS)\monodll_url.obj: ..\..\src\common\url.cpp $(OBJS)\monodll_gsocket.obj: ..\..\src\msw\gsocket.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** +$(OBJS)\monodll_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp + $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** + $(OBJS)\monodll_urlmsw.obj: ..\..\src\msw\urlmsw.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** @@ -6094,11 +6093,6 @@ $(OBJS)\monodll_graphics.obj: ..\..\src\msw\graphics.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\monodll_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp - $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\monodll_icon.obj: ..\..\src\msw\icon.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) $** @@ -7603,6 +7597,9 @@ $(OBJS)\monolib_url.obj: ..\..\src\common\url.cpp $(OBJS)\monolib_gsocket.obj: ..\..\src\msw\gsocket.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** +$(OBJS)\monolib_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp + $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** + $(OBJS)\monolib_urlmsw.obj: ..\..\src\msw\urlmsw.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** @@ -8194,11 +8191,6 @@ $(OBJS)\monolib_graphics.obj: ..\..\src\msw\graphics.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\monolib_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp - $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\monolib_icon.obj: ..\..\src\msw\icon.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) $** @@ -10012,6 +10004,9 @@ $(OBJS)\netdll_url.obj: ..\..\src\common\url.cpp $(OBJS)\netdll_gsocket.obj: ..\..\src\msw\gsocket.cpp $(CXX) -q -c -P -o$@ $(NETDLL_CXXFLAGS) $** +$(OBJS)\netdll_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp + $(CXX) -q -c -P -o$@ $(NETDLL_CXXFLAGS) $** + $(OBJS)\netdll_urlmsw.obj: ..\..\src\msw\urlmsw.cpp $(CXX) -q -c -P -o$@ $(NETDLL_CXXFLAGS) $** @@ -10051,6 +10046,9 @@ $(OBJS)\netlib_url.obj: ..\..\src\common\url.cpp $(OBJS)\netlib_gsocket.obj: ..\..\src\msw\gsocket.cpp $(CXX) -q -c -P -o$@ $(NETLIB_CXXFLAGS) $** +$(OBJS)\netlib_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp + $(CXX) -q -c -P -o$@ $(NETLIB_CXXFLAGS) $** + $(OBJS)\netlib_urlmsw.obj: ..\..\src\msw\urlmsw.cpp $(CXX) -q -c -P -o$@ $(NETLIB_CXXFLAGS) $** @@ -10348,11 +10346,6 @@ $(OBJS)\coredll_graphics.obj: ..\..\src\msw\graphics.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\coredll_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp - $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\coredll_icon.obj: ..\..\src\msw\icon.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) $** @@ -11659,11 +11652,6 @@ $(OBJS)\corelib_graphics.obj: ..\..\src\msw\graphics.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\corelib_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp - $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\corelib_icon.obj: ..\..\src\msw\icon.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) $** diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index bd0f9a76ff..f55a560f9d 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -402,6 +402,7 @@ MONODLL_OBJECTS = \ $(OBJS)\monodll_socket.o \ $(OBJS)\monodll_url.o \ $(OBJS)\monodll_gsocket.o \ + $(OBJS)\monodll_gsockmsw.o \ $(OBJS)\monodll_urlmsw.o \ $(____MONOLIB_GUI_SRC_FILENAMES_OBJECTS) \ $(OBJS)\monodll_xml.o \ @@ -539,6 +540,7 @@ MONOLIB_OBJECTS = \ $(OBJS)\monolib_socket.o \ $(OBJS)\monolib_url.o \ $(OBJS)\monolib_gsocket.o \ + $(OBJS)\monolib_gsockmsw.o \ $(OBJS)\monolib_urlmsw.o \ $(____MONOLIB_GUI_SRC_FILENAMES_1_OBJECTS) \ $(OBJS)\monolib_xml.o \ @@ -804,6 +806,7 @@ NETDLL_OBJECTS = \ $(OBJS)\netdll_socket.o \ $(OBJS)\netdll_url.o \ $(OBJS)\netdll_gsocket.o \ + $(OBJS)\netdll_gsockmsw.o \ $(OBJS)\netdll_urlmsw.o NETLIB_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) $(GCCFLAGS) \ -DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \ @@ -826,6 +829,7 @@ NETLIB_OBJECTS = \ $(OBJS)\netlib_socket.o \ $(OBJS)\netlib_url.o \ $(OBJS)\netlib_gsocket.o \ + $(OBJS)\netlib_gsockmsw.o \ $(OBJS)\netlib_urlmsw.o COREDLL_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) \ $(GCCFLAGS) -DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) \ @@ -1505,7 +1509,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gdiobj.o \ $(OBJS)\monodll_gdiplus.o \ $(OBJS)\monodll_graphics.o \ - $(OBJS)\monodll_gsockmsw.o \ $(OBJS)\monodll_icon.o \ $(OBJS)\monodll_imaglist.o \ $(OBJS)\monodll_minifram.o \ @@ -1736,7 +1739,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gdiobj.o \ $(OBJS)\monodll_gdiplus.o \ $(OBJS)\monodll_graphics.o \ - $(OBJS)\monodll_gsockmsw.o \ $(OBJS)\monodll_icon.o \ $(OBJS)\monodll_imaglist.o \ $(OBJS)\monodll_minifram.o \ @@ -2154,7 +2156,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gdiobj.o \ $(OBJS)\monolib_gdiplus.o \ $(OBJS)\monolib_graphics.o \ - $(OBJS)\monolib_gsockmsw.o \ $(OBJS)\monolib_icon.o \ $(OBJS)\monolib_imaglist.o \ $(OBJS)\monolib_minifram.o \ @@ -2385,7 +2386,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gdiobj.o \ $(OBJS)\monolib_gdiplus.o \ $(OBJS)\monolib_graphics.o \ - $(OBJS)\monolib_gsockmsw.o \ $(OBJS)\monolib_icon.o \ $(OBJS)\monolib_imaglist.o \ $(OBJS)\monolib_minifram.o \ @@ -2728,7 +2728,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_gdiobj.o \ $(OBJS)\coredll_gdiplus.o \ $(OBJS)\coredll_graphics.o \ - $(OBJS)\coredll_gsockmsw.o \ $(OBJS)\coredll_icon.o \ $(OBJS)\coredll_imaglist.o \ $(OBJS)\coredll_minifram.o \ @@ -2959,7 +2958,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_gdiobj.o \ $(OBJS)\coredll_gdiplus.o \ $(OBJS)\coredll_graphics.o \ - $(OBJS)\coredll_gsockmsw.o \ $(OBJS)\coredll_icon.o \ $(OBJS)\coredll_imaglist.o \ $(OBJS)\coredll_minifram.o \ @@ -3200,7 +3198,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_gdiobj.o \ $(OBJS)\corelib_gdiplus.o \ $(OBJS)\corelib_graphics.o \ - $(OBJS)\corelib_gsockmsw.o \ $(OBJS)\corelib_icon.o \ $(OBJS)\corelib_imaglist.o \ $(OBJS)\corelib_minifram.o \ @@ -3431,7 +3428,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_gdiobj.o \ $(OBJS)\corelib_gdiplus.o \ $(OBJS)\corelib_graphics.o \ - $(OBJS)\corelib_gsockmsw.o \ $(OBJS)\corelib_icon.o \ $(OBJS)\corelib_imaglist.o \ $(OBJS)\corelib_minifram.o \ @@ -5643,6 +5639,9 @@ $(OBJS)\monodll_url.o: ../../src/common/url.cpp $(OBJS)\monodll_gsocket.o: ../../src/msw/gsocket.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\monodll_gsockmsw.o: ../../src/msw/gsockmsw.cpp + $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\monodll_urlmsw.o: ../../src/msw/urlmsw.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< @@ -6234,11 +6233,6 @@ $(OBJS)\monodll_graphics.o: ../../src/msw/graphics.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< endif -ifeq ($(USE_GUI),1) -$(OBJS)\monodll_gsockmsw.o: ../../src/msw/gsockmsw.cpp - $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< -endif - ifeq ($(USE_GUI),1) $(OBJS)\monodll_icon.o: ../../src/msw/icon.cpp $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< @@ -7845,6 +7839,9 @@ $(OBJS)\monolib_url.o: ../../src/common/url.cpp $(OBJS)\monolib_gsocket.o: ../../src/msw/gsocket.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\monolib_gsockmsw.o: ../../src/msw/gsockmsw.cpp + $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\monolib_urlmsw.o: ../../src/msw/urlmsw.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< @@ -8436,11 +8433,6 @@ $(OBJS)\monolib_graphics.o: ../../src/msw/graphics.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< endif -ifeq ($(USE_GUI),1) -$(OBJS)\monolib_gsockmsw.o: ../../src/msw/gsockmsw.cpp - $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< -endif - ifeq ($(USE_GUI),1) $(OBJS)\monolib_icon.o: ../../src/msw/icon.cpp $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< @@ -10356,6 +10348,9 @@ $(OBJS)\netdll_url.o: ../../src/common/url.cpp $(OBJS)\netdll_gsocket.o: ../../src/msw/gsocket.cpp $(CXX) -c -o $@ $(NETDLL_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\netdll_gsockmsw.o: ../../src/msw/gsockmsw.cpp + $(CXX) -c -o $@ $(NETDLL_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\netdll_urlmsw.o: ../../src/msw/urlmsw.cpp $(CXX) -c -o $@ $(NETDLL_CXXFLAGS) $(CPPDEPS) $< @@ -10395,6 +10390,9 @@ $(OBJS)\netlib_url.o: ../../src/common/url.cpp $(OBJS)\netlib_gsocket.o: ../../src/msw/gsocket.cpp $(CXX) -c -o $@ $(NETLIB_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\netlib_gsockmsw.o: ../../src/msw/gsockmsw.cpp + $(CXX) -c -o $@ $(NETLIB_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\netlib_urlmsw.o: ../../src/msw/urlmsw.cpp $(CXX) -c -o $@ $(NETLIB_CXXFLAGS) $(CPPDEPS) $< @@ -10692,11 +10690,6 @@ $(OBJS)\coredll_graphics.o: ../../src/msw/graphics.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< endif -ifeq ($(USE_GUI),1) -$(OBJS)\coredll_gsockmsw.o: ../../src/msw/gsockmsw.cpp - $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< -endif - ifeq ($(USE_GUI),1) $(OBJS)\coredll_icon.o: ../../src/msw/icon.cpp $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< @@ -12103,11 +12096,6 @@ $(OBJS)\corelib_graphics.o: ../../src/msw/graphics.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< endif -ifeq ($(USE_GUI),1) -$(OBJS)\corelib_gsockmsw.o: ../../src/msw/gsockmsw.cpp - $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< -endif - ifeq ($(USE_GUI),1) $(OBJS)\corelib_icon.o: ../../src/msw/icon.cpp $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index cab48b19f1..9947a93a22 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -419,6 +419,7 @@ MONODLL_OBJECTS = \ $(OBJS)\monodll_socket.obj \ $(OBJS)\monodll_url.obj \ $(OBJS)\monodll_gsocket.obj \ + $(OBJS)\monodll_gsockmsw.obj \ $(OBJS)\monodll_urlmsw.obj \ $(____MONOLIB_GUI_SRC_FILENAMES_OBJECTS) \ $(OBJS)\monodll_xml.obj \ @@ -560,6 +561,7 @@ MONOLIB_OBJECTS = \ $(OBJS)\monolib_socket.obj \ $(OBJS)\monolib_url.obj \ $(OBJS)\monolib_gsocket.obj \ + $(OBJS)\monolib_gsockmsw.obj \ $(OBJS)\monolib_urlmsw.obj \ $(____MONOLIB_GUI_SRC_FILENAMES_1_OBJECTS) \ $(OBJS)\monolib_xml.obj \ @@ -836,6 +838,7 @@ NETDLL_OBJECTS = \ $(OBJS)\netdll_socket.obj \ $(OBJS)\netdll_url.obj \ $(OBJS)\netdll_gsocket.obj \ + $(OBJS)\netdll_gsockmsw.obj \ $(OBJS)\netdll_urlmsw.obj NETLIB_CXXFLAGS = /M$(__RUNTIME_LIBS_167)$(__DEBUGRUNTIME) /DWIN32 \ $(__DEBUGINFO) \ @@ -861,6 +864,7 @@ NETLIB_OBJECTS = \ $(OBJS)\netlib_socket.obj \ $(OBJS)\netlib_url.obj \ $(OBJS)\netlib_gsocket.obj \ + $(OBJS)\netlib_gsockmsw.obj \ $(OBJS)\netlib_urlmsw.obj COREDLL_CXXFLAGS = /M$(__RUNTIME_LIBS_181)$(__DEBUGRUNTIME) /DWIN32 \ $(__DEBUGINFO) \ @@ -1664,7 +1668,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gdiobj.obj \ $(OBJS)\monodll_gdiplus.obj \ $(OBJS)\monodll_graphics.obj \ - $(OBJS)\monodll_gsockmsw.obj \ $(OBJS)\monodll_icon.obj \ $(OBJS)\monodll_imaglist.obj \ $(OBJS)\monodll_minifram.obj \ @@ -1893,7 +1896,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_gdiobj.obj \ $(OBJS)\monodll_gdiplus.obj \ $(OBJS)\monodll_graphics.obj \ - $(OBJS)\monodll_gsockmsw.obj \ $(OBJS)\monodll_icon.obj \ $(OBJS)\monodll_imaglist.obj \ $(OBJS)\monodll_minifram.obj \ @@ -2313,7 +2315,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gdiobj.obj \ $(OBJS)\monolib_gdiplus.obj \ $(OBJS)\monolib_graphics.obj \ - $(OBJS)\monolib_gsockmsw.obj \ $(OBJS)\monolib_icon.obj \ $(OBJS)\monolib_imaglist.obj \ $(OBJS)\monolib_minifram.obj \ @@ -2542,7 +2543,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_gdiobj.obj \ $(OBJS)\monolib_gdiplus.obj \ $(OBJS)\monolib_graphics.obj \ - $(OBJS)\monolib_gsockmsw.obj \ $(OBJS)\monolib_icon.obj \ $(OBJS)\monolib_imaglist.obj \ $(OBJS)\monolib_minifram.obj \ @@ -2901,7 +2901,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_gdiobj.obj \ $(OBJS)\coredll_gdiplus.obj \ $(OBJS)\coredll_graphics.obj \ - $(OBJS)\coredll_gsockmsw.obj \ $(OBJS)\coredll_icon.obj \ $(OBJS)\coredll_imaglist.obj \ $(OBJS)\coredll_minifram.obj \ @@ -3130,7 +3129,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_gdiobj.obj \ $(OBJS)\coredll_gdiplus.obj \ $(OBJS)\coredll_graphics.obj \ - $(OBJS)\coredll_gsockmsw.obj \ $(OBJS)\coredll_icon.obj \ $(OBJS)\coredll_imaglist.obj \ $(OBJS)\coredll_minifram.obj \ @@ -3371,7 +3369,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_gdiobj.obj \ $(OBJS)\corelib_gdiplus.obj \ $(OBJS)\corelib_graphics.obj \ - $(OBJS)\corelib_gsockmsw.obj \ $(OBJS)\corelib_icon.obj \ $(OBJS)\corelib_imaglist.obj \ $(OBJS)\corelib_minifram.obj \ @@ -3600,7 +3597,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_gdiobj.obj \ $(OBJS)\corelib_gdiplus.obj \ $(OBJS)\corelib_graphics.obj \ - $(OBJS)\corelib_gsockmsw.obj \ $(OBJS)\corelib_icon.obj \ $(OBJS)\corelib_imaglist.obj \ $(OBJS)\corelib_minifram.obj \ @@ -5835,6 +5831,9 @@ $(OBJS)\monodll_url.obj: ..\..\src\common\url.cpp $(OBJS)\monodll_gsocket.obj: ..\..\src\msw\gsocket.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** +$(OBJS)\monodll_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** + $(OBJS)\monodll_urlmsw.obj: ..\..\src\msw\urlmsw.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** @@ -6426,11 +6425,6 @@ $(OBJS)\monodll_graphics.obj: ..\..\src\msw\graphics.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\monodll_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\monodll_icon.obj: ..\..\src\msw\icon.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) $** @@ -7935,6 +7929,9 @@ $(OBJS)\monolib_url.obj: ..\..\src\common\url.cpp $(OBJS)\monolib_gsocket.obj: ..\..\src\msw\gsocket.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** +$(OBJS)\monolib_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp + $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** + $(OBJS)\monolib_urlmsw.obj: ..\..\src\msw\urlmsw.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** @@ -8526,11 +8523,6 @@ $(OBJS)\monolib_graphics.obj: ..\..\src\msw\graphics.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\monolib_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp - $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\monolib_icon.obj: ..\..\src\msw\icon.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) $** @@ -10344,6 +10336,9 @@ $(OBJS)\netdll_url.obj: ..\..\src\common\url.cpp $(OBJS)\netdll_gsocket.obj: ..\..\src\msw\gsocket.cpp $(CXX) /c /nologo /TP /Fo$@ $(NETDLL_CXXFLAGS) $** +$(OBJS)\netdll_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp + $(CXX) /c /nologo /TP /Fo$@ $(NETDLL_CXXFLAGS) $** + $(OBJS)\netdll_urlmsw.obj: ..\..\src\msw\urlmsw.cpp $(CXX) /c /nologo /TP /Fo$@ $(NETDLL_CXXFLAGS) $** @@ -10383,6 +10378,9 @@ $(OBJS)\netlib_url.obj: ..\..\src\common\url.cpp $(OBJS)\netlib_gsocket.obj: ..\..\src\msw\gsocket.cpp $(CXX) /c /nologo /TP /Fo$@ $(NETLIB_CXXFLAGS) $** +$(OBJS)\netlib_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp + $(CXX) /c /nologo /TP /Fo$@ $(NETLIB_CXXFLAGS) $** + $(OBJS)\netlib_urlmsw.obj: ..\..\src\msw\urlmsw.cpp $(CXX) /c /nologo /TP /Fo$@ $(NETLIB_CXXFLAGS) $** @@ -10680,11 +10678,6 @@ $(OBJS)\coredll_graphics.obj: ..\..\src\msw\graphics.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\coredll_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp - $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\coredll_icon.obj: ..\..\src\msw\icon.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) $** @@ -11991,11 +11984,6 @@ $(OBJS)\corelib_graphics.obj: ..\..\src\msw\graphics.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** !endif -!if "$(USE_GUI)" == "1" -$(OBJS)\corelib_gsockmsw.obj: ..\..\src\msw\gsockmsw.cpp - $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** -!endif - !if "$(USE_GUI)" == "1" $(OBJS)\corelib_icon.obj: ..\..\src\msw\icon.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) $** diff --git a/build/msw/makefile.wat b/build/msw/makefile.wat index a9ce3c1220..b14382546c 100644 --- a/build/msw/makefile.wat +++ b/build/msw/makefile.wat @@ -234,7 +234,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_gdiobj.obj & $(OBJS)\monodll_gdiplus.obj & $(OBJS)\monodll_graphics.obj & - $(OBJS)\monodll_gsockmsw.obj & $(OBJS)\monodll_icon.obj & $(OBJS)\monodll_imaglist.obj & $(OBJS)\monodll_minifram.obj & @@ -465,7 +464,6 @@ ____CORE_SRC_FILENAMES_OBJECTS = & $(OBJS)\monodll_gdiobj.obj & $(OBJS)\monodll_gdiplus.obj & $(OBJS)\monodll_graphics.obj & - $(OBJS)\monodll_gsockmsw.obj & $(OBJS)\monodll_icon.obj & $(OBJS)\monodll_imaglist.obj & $(OBJS)\monodll_minifram.obj & @@ -888,7 +886,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_gdiobj.obj & $(OBJS)\monolib_gdiplus.obj & $(OBJS)\monolib_graphics.obj & - $(OBJS)\monolib_gsockmsw.obj & $(OBJS)\monolib_icon.obj & $(OBJS)\monolib_imaglist.obj & $(OBJS)\monolib_minifram.obj & @@ -1119,7 +1116,6 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = & $(OBJS)\monolib_gdiobj.obj & $(OBJS)\monolib_gdiplus.obj & $(OBJS)\monolib_graphics.obj & - $(OBJS)\monolib_gsockmsw.obj & $(OBJS)\monolib_icon.obj & $(OBJS)\monolib_imaglist.obj & $(OBJS)\monolib_minifram.obj & @@ -1473,7 +1469,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_gdiobj.obj & $(OBJS)\coredll_gdiplus.obj & $(OBJS)\coredll_graphics.obj & - $(OBJS)\coredll_gsockmsw.obj & $(OBJS)\coredll_icon.obj & $(OBJS)\coredll_imaglist.obj & $(OBJS)\coredll_minifram.obj & @@ -1704,7 +1699,6 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = & $(OBJS)\coredll_gdiobj.obj & $(OBJS)\coredll_gdiplus.obj & $(OBJS)\coredll_graphics.obj & - $(OBJS)\coredll_gsockmsw.obj & $(OBJS)\coredll_icon.obj & $(OBJS)\coredll_imaglist.obj & $(OBJS)\coredll_minifram.obj & @@ -1947,7 +1941,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_gdiobj.obj & $(OBJS)\corelib_gdiplus.obj & $(OBJS)\corelib_graphics.obj & - $(OBJS)\corelib_gsockmsw.obj & $(OBJS)\corelib_icon.obj & $(OBJS)\corelib_imaglist.obj & $(OBJS)\corelib_minifram.obj & @@ -2178,7 +2171,6 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = & $(OBJS)\corelib_gdiobj.obj & $(OBJS)\corelib_gdiplus.obj & $(OBJS)\corelib_graphics.obj & - $(OBJS)\corelib_gsockmsw.obj & $(OBJS)\corelib_icon.obj & $(OBJS)\corelib_imaglist.obj & $(OBJS)\corelib_minifram.obj & @@ -3354,6 +3346,7 @@ MONODLL_OBJECTS = & $(OBJS)\monodll_socket.obj & $(OBJS)\monodll_url.obj & $(OBJS)\monodll_gsocket.obj & + $(OBJS)\monodll_gsockmsw.obj & $(OBJS)\monodll_urlmsw.obj & $(____MONOLIB_GUI_SRC_FILENAMES_OBJECTS) & $(OBJS)\monodll_xml.obj & @@ -3490,6 +3483,7 @@ MONOLIB_OBJECTS = & $(OBJS)\monolib_socket.obj & $(OBJS)\monolib_url.obj & $(OBJS)\monolib_gsocket.obj & + $(OBJS)\monolib_gsockmsw.obj & $(OBJS)\monolib_urlmsw.obj & $(____MONOLIB_GUI_SRC_FILENAMES_1_OBJECTS) & $(OBJS)\monolib_xml.obj & @@ -3753,6 +3747,7 @@ NETDLL_OBJECTS = & $(OBJS)\netdll_socket.obj & $(OBJS)\netdll_url.obj & $(OBJS)\netdll_gsocket.obj & + $(OBJS)\netdll_gsockmsw.obj & $(OBJS)\netdll_urlmsw.obj NETLIB_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) & $(__RUNTIME_LIBS) -d__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) & @@ -3775,6 +3770,7 @@ NETLIB_OBJECTS = & $(OBJS)\netlib_socket.obj & $(OBJS)\netlib_url.obj & $(OBJS)\netlib_gsocket.obj & + $(OBJS)\netlib_gsockmsw.obj & $(OBJS)\netlib_urlmsw.obj COREDLL_CXXFLAGS = -bd $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) & $(__RUNTIME_LIBS) -d__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) & @@ -5877,6 +5873,9 @@ $(OBJS)\monodll_url.obj : .AUTODEPEND ..\..\src\common\url.cpp $(OBJS)\monodll_gsocket.obj : .AUTODEPEND ..\..\src\msw\gsocket.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< +$(OBJS)\monodll_gsockmsw.obj : .AUTODEPEND ..\..\src\msw\gsockmsw.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< + $(OBJS)\monodll_urlmsw.obj : .AUTODEPEND ..\..\src\msw\urlmsw.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< @@ -6468,11 +6467,6 @@ $(OBJS)\monodll_graphics.obj : .AUTODEPEND ..\..\src\msw\graphics.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< !endif -!ifeq USE_GUI 1 -$(OBJS)\monodll_gsockmsw.obj : .AUTODEPEND ..\..\src\msw\gsockmsw.cpp - $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< -!endif - !ifeq USE_GUI 1 $(OBJS)\monodll_icon.obj : .AUTODEPEND ..\..\src\msw\icon.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< @@ -8079,6 +8073,9 @@ $(OBJS)\monolib_url.obj : .AUTODEPEND ..\..\src\common\url.cpp $(OBJS)\monolib_gsocket.obj : .AUTODEPEND ..\..\src\msw\gsocket.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< +$(OBJS)\monolib_gsockmsw.obj : .AUTODEPEND ..\..\src\msw\gsockmsw.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< + $(OBJS)\monolib_urlmsw.obj : .AUTODEPEND ..\..\src\msw\urlmsw.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< @@ -8670,11 +8667,6 @@ $(OBJS)\monolib_graphics.obj : .AUTODEPEND ..\..\src\msw\graphics.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< !endif -!ifeq USE_GUI 1 -$(OBJS)\monolib_gsockmsw.obj : .AUTODEPEND ..\..\src\msw\gsockmsw.cpp - $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< -!endif - !ifeq USE_GUI 1 $(OBJS)\monolib_icon.obj : .AUTODEPEND ..\..\src\msw\icon.cpp $(CXX) -bt=nt -zq -fo=$^@ $(MONOLIB_CXXFLAGS) $< @@ -10590,6 +10582,9 @@ $(OBJS)\netdll_url.obj : .AUTODEPEND ..\..\src\common\url.cpp $(OBJS)\netdll_gsocket.obj : .AUTODEPEND ..\..\src\msw\gsocket.cpp $(CXX) -bt=nt -zq -fo=$^@ $(NETDLL_CXXFLAGS) $< +$(OBJS)\netdll_gsockmsw.obj : .AUTODEPEND ..\..\src\msw\gsockmsw.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(NETDLL_CXXFLAGS) $< + $(OBJS)\netdll_urlmsw.obj : .AUTODEPEND ..\..\src\msw\urlmsw.cpp $(CXX) -bt=nt -zq -fo=$^@ $(NETDLL_CXXFLAGS) $< @@ -10629,6 +10624,9 @@ $(OBJS)\netlib_url.obj : .AUTODEPEND ..\..\src\common\url.cpp $(OBJS)\netlib_gsocket.obj : .AUTODEPEND ..\..\src\msw\gsocket.cpp $(CXX) -bt=nt -zq -fo=$^@ $(NETLIB_CXXFLAGS) $< +$(OBJS)\netlib_gsockmsw.obj : .AUTODEPEND ..\..\src\msw\gsockmsw.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(NETLIB_CXXFLAGS) $< + $(OBJS)\netlib_urlmsw.obj : .AUTODEPEND ..\..\src\msw\urlmsw.cpp $(CXX) -bt=nt -zq -fo=$^@ $(NETLIB_CXXFLAGS) $< @@ -10926,11 +10924,6 @@ $(OBJS)\coredll_graphics.obj : .AUTODEPEND ..\..\src\msw\graphics.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< !endif -!ifeq USE_GUI 1 -$(OBJS)\coredll_gsockmsw.obj : .AUTODEPEND ..\..\src\msw\gsockmsw.cpp - $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< -!endif - !ifeq USE_GUI 1 $(OBJS)\coredll_icon.obj : .AUTODEPEND ..\..\src\msw\icon.cpp $(CXX) -bt=nt -zq -fo=$^@ $(COREDLL_CXXFLAGS) $< @@ -12337,11 +12330,6 @@ $(OBJS)\corelib_graphics.obj : .AUTODEPEND ..\..\src\msw\graphics.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< !endif -!ifeq USE_GUI 1 -$(OBJS)\corelib_gsockmsw.obj : .AUTODEPEND ..\..\src\msw\gsockmsw.cpp - $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< -!endif - !ifeq USE_GUI 1 $(OBJS)\corelib_icon.obj : .AUTODEPEND ..\..\src\msw\icon.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CORELIB_CXXFLAGS) $< diff --git a/build/msw/wx_core.dsp b/build/msw/wx_core.dsp index 0e98b018b3..bc98429ace 100644 --- a/build/msw/wx_core.dsp +++ b/build/msw/wx_core.dsp @@ -1435,10 +1435,6 @@ SOURCE=..\..\src\msw\graphics.cpp # End Source File # Begin Source File -SOURCE=..\..\src\msw\gsockmsw.cpp -# End Source File -# Begin Source File - SOURCE=..\..\src\msw\helpchm.cpp # End Source File # Begin Source File diff --git a/build/msw/wx_net.dsp b/build/msw/wx_net.dsp index 773b9c10c4..6c6748ead2 100644 --- a/build/msw/wx_net.dsp +++ b/build/msw/wx_net.dsp @@ -298,6 +298,10 @@ SOURCE=..\..\src\msw\gsocket.cpp # End Source File # Begin Source File +SOURCE=..\..\src\msw\gsockmsw.cpp +# End Source File +# Begin Source File + SOURCE=..\..\src\msw\urlmsw.cpp # End Source File # Begin Source File diff --git a/configure.in b/configure.in index 3c785eade8..158fa4432f 100644 --- a/configure.in +++ b/configure.in @@ -7219,6 +7219,9 @@ if test "$wxUSE_GUI" = "yes"; then fi else SAMPLES_SUBDIRS="console" + if test "$wxUSE_SOCKETS" = "yes" ; then + SAMPLES_SUBDIRS="$SAMPLES_SUBDIRS sockets" + fi fi @@ -7852,7 +7855,14 @@ for subdir in $SUBDIRS; do dnl don't take all samples/utils, just those which build with dnl wxBase if test ${subdir} = "samples"; then - makefiles="samples/Makefile.in samples/console/Makefile.in" + dnl only take those samples which compile in the current + dnl configuration and which exist + makefiles="samples/Makefile.in $makefiles" + for sample in `echo $SAMPLES_SUBDIRS`; do + if test -d $srcdir/samples/$sample; then + makefiles="samples/$sample/Makefile.in $makefiles" + fi + done elif test ${subdir} = "utils"; then makefiles="" for util in HelpGen tex2rtf ; do diff --git a/docs/changes.txt b/docs/changes.txt index c1412642d1..0f13127a54 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -165,7 +165,7 @@ Major new features in this release - wxWidgets may now use either wchar_t (UTF-16/32) or UTF-8 internally, depending on what is optimal for the target platform. -- Events loops and timers can now be used in wxBase, without GUI. +- Events loops, timers and sockets can now be used in wxBase, without GUI. 2.9.0 diff --git a/include/wx/apptrait.h b/include/wx/apptrait.h index 8273281581..73110bbcc1 100644 --- a/include/wx/apptrait.h +++ b/include/wx/apptrait.h @@ -30,7 +30,7 @@ class WXDLLIMPEXP_FWD_BASE wxString; class WXDLLIMPEXP_FWD_BASE wxTimer; class WXDLLIMPEXP_FWD_BASE wxTimerImpl; -class GSocketGUIFunctionsTable; +class GSocketManager; // ---------------------------------------------------------------------------- @@ -116,13 +116,9 @@ public: virtual void RemoveFromPendingDelete(wxObject *object) = 0; #if wxUSE_SOCKETS - // return table of GUI callbacks for GSocket code or NULL in wxBase. This - // is needed because networking classes are in their own library and so - // they can't directly call GUI functions (the same net library can be - // used in both GUI and base apps). To complicate it further, GUI library - // ("wxCore") doesn't depend on networking library and so only a functions - // table can be passed around - virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable() = 0; + // return socket manager: this is usually different for console and GUI + // applications (although some ports use the same implementation for both) + virtual GSocketManager *GetSocketManager() = 0; #endif // create a new, port specific, instance of the event loop used by wxApp @@ -220,9 +216,6 @@ public: virtual wxFontMapper *CreateFontMapper(); #endif // wxUSE_FONTMAP virtual wxRendererNative *CreateRenderer(); -#if wxUSE_SOCKETS - virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable(); -#endif #ifdef __WXDEBUG__ virtual bool ShowAssertDialog(const wxString& msg); @@ -264,9 +257,6 @@ public: virtual wxFontMapper *CreateFontMapper(); #endif // wxUSE_FONTMAP virtual wxRendererNative *CreateRenderer(); -#if wxUSE_SOCKETS - virtual GSocketGUIFunctionsTable* GetSocketGUIFunctionsTable(); -#endif #ifdef __WXDEBUG__ virtual bool ShowAssertDialog(const wxString& msg); diff --git a/include/wx/gsocket.h b/include/wx/gsocket.h index 2d5b0288bb..1de34db8fb 100644 --- a/include/wx/gsocket.h +++ b/include/wx/gsocket.h @@ -2,25 +2,23 @@ * Project: GSocket (Generic Socket) * Name: gsocket.h * Author: Guilhem Lavaux - * Guillermo Rodriguez Garcia (maintainer) + * Guillermo Rodriguez Garcia * Copyright: (c) Guilhem Lavaux + * (c) 2007 Vadim Zeitlin * Licence: wxWindows Licence * Purpose: GSocket include file (system independent) * CVSID: $Id$ * ------------------------------------------------------------------------- */ -#ifndef __GSOCKET_H -#define __GSOCKET_H +#ifndef _WX_GSOCKET_H_ +#define _WX_GSOCKET_H_ -#ifndef __GSOCKET_STANDALONE__ #include "wx/defs.h" -#include "wx/dlimpexp.h" /* for WXDLLIMPEXP_NET */ - -#endif +#if wxUSE_SOCKETS -#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) +#include "wx/dlimpexp.h" /* for WXDLLIMPEXP_NET */ #include @@ -37,27 +35,24 @@ #include #endif -class GSocket; - -#ifdef __cplusplus -extern "C" { -#endif - typedef struct _GAddress GAddress; -typedef enum { +enum GAddressType +{ GSOCK_NOFAMILY = 0, GSOCK_INET, GSOCK_INET6, GSOCK_UNIX -} GAddressType; +}; -typedef enum { +enum GSocketStream +{ GSOCK_STREAMED, GSOCK_UNSTREAMED -} GSocketStream; +}; -typedef enum { +enum GSocketError +{ GSOCK_NOERROR = 0, GSOCK_INVOP, GSOCK_IOERR, @@ -69,19 +64,21 @@ typedef enum { GSOCK_TIMEDOUT, GSOCK_MEMERR, GSOCK_OPTERR -} GSocketError; +}; /* See below for an explanation on how events work. */ -typedef enum { +enum GSocketEvent +{ GSOCK_INPUT = 0, GSOCK_OUTPUT = 1, GSOCK_CONNECTION = 2, GSOCK_LOST = 3, GSOCK_MAX_EVENT = 4 -} GSocketEvent; +}; -enum { +enum +{ GSOCK_INPUT_FLAG = 1 << GSOCK_INPUT, GSOCK_OUTPUT_FLAG = 1 << GSOCK_OUTPUT, GSOCK_CONNECTION_FLAG = 1 << GSOCK_CONNECTION, @@ -90,54 +87,99 @@ enum { typedef int GSocketEventFlags; +class GSocket; + typedef void (*GSocketCallback)(GSocket *socket, GSocketEvent event, char *cdata); - -/* Functions tables for internal use by GSocket code: */ - -/* Actually this is a misnomer now, but reusing this name means I don't - have to ifdef app traits or common socket code */ -class GSocketGUIFunctionsTable +/* + Class providing hooks abstracting the differences between console and GUI + applications for socket code. + + We also have different implementations of this class for different platforms + allowing us to keep more things in the common code but the main reason for + its existence is that we want the same socket code work differently + depending on whether it's used from a console or a GUI program. This is + achieved by implementing the virtual methods of this class differently in + the objects returned by wxConsoleAppTraits::GetSocketFunctionsTable() and + the same method in wxGUIAppTraits. + */ +class GSocketManager { public: - // needed since this class declares virtual members - virtual ~GSocketGUIFunctionsTable() { } + // set the manager to use, we don't take ownership of it + // + // this should be called before GSocket_Init(), i.e. before the first + // wxSocket object is created, otherwise the manager returned by + // wxAppTraits::GetSocketManager() will be used + static void Set(GSocketManager *manager); + + // return the manager to use + // + // this initializes the manager at first use + static GSocketManager *Get() + { + if ( !ms_manager ) + Init(); + + return ms_manager; + } + + // called before the first wxSocket is created and should do the + // initializations needed in order to use the network + // + // return true if initialized successfully virtual bool OnInit() = 0; + + // undo the initializations of OnInit() virtual void OnExit() = 0; - virtual bool CanUseEventLoop() = 0; + + + // do manager-specific socket initializations (and undo it): this is called + // in the beginning/end of the socket initialization/destruction virtual bool Init_Socket(GSocket *socket) = 0; virtual void Destroy_Socket(GSocket *socket) = 0; -#ifndef __WINDOWS__ + virtual void Install_Callback(GSocket *socket, GSocketEvent event) = 0; virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event) = 0; -#endif + virtual void Enable_Events(GSocket *socket) = 0; virtual void Disable_Events(GSocket *socket) = 0; + + virtual ~GSocketManager() { } + +private: + // get the manager to use if we don't have it yet + static void Init(); + + static GSocketManager *ms_manager; }; +#if defined(__WINDOWS__) + #include "wx/msw/gsockmsw.h" +#else + #include "wx/unix/gsockunx.h" +#endif -/* Global initializers */ -/* Sets GUI functions callbacks. Must be called *before* GSocket_Init - if the app uses async sockets. */ -void GSocket_SetGUIFunctions(GSocketGUIFunctionsTable *guifunc); +/* Global initializers */ -/* GSocket_Init() must be called at the beginning */ -int GSocket_Init(void); +/* GSocket_Init() must be called at the beginning (but after calling + * GSocketManager::Set() if a custom manager should be used) */ +bool GSocket_Init(); /* GSocket_Cleanup() must be called at the end */ -void GSocket_Cleanup(void); +void GSocket_Cleanup(); /* Constructors / Destructors */ -GSocket *GSocket_new(void); +GSocket *GSocket_new(); /* GAddress */ -GAddress *GAddress_new(void); +GAddress *GAddress_new(); GAddress *GAddress_copy(GAddress *address); void GAddress_destroy(GAddress *address); @@ -185,16 +227,6 @@ unsigned short GAddress_INET6_GetPort(GAddress *address); GSocketError GAddress_UNIX_SetPath(GAddress *address, const char *path); GSocketError GAddress_UNIX_GetPath(GAddress *address, char *path, size_t sbuf); -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -# if defined(__WINDOWS__) -# include "wx/msw/gsockmsw.h" -# else -# include "wx/unix/gsockunx.h" -# endif - -#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ +#endif /* wxUSE_SOCKETS */ -#endif /* __GSOCKET_H */ +#endif /* _WX_GSOCKET_H_ */ diff --git a/include/wx/motif/private.h b/include/wx/motif/private.h index 3301bbfc39..871497df94 100644 --- a/include/wx/motif/private.h +++ b/include/wx/motif/private.h @@ -13,7 +13,8 @@ #define _WX_PRIVATE_H_ #include "wx/defs.h" -#include "X11/Xlib.h" +#include +#include #include "wx/evtloop.h" class WXDLLIMPEXP_FWD_CORE wxFont; diff --git a/include/wx/msw/apptbase.h b/include/wx/msw/apptbase.h index 0284e348d7..34101ac4ba 100644 --- a/include/wx/msw/apptbase.h +++ b/include/wx/msw/apptbase.h @@ -45,10 +45,32 @@ public: // the GUI code, WAIT_OBJECT_0 + 1 if a Windows message arrived virtual WXDWORD WaitForThread(WXHANDLE hThread) = 0; + + // wxSocket support + // ---------------- + +#if wxUSE_SOCKETS + // this function is used by wxNet library to set the default socket manager + // to use: doing it like this allows us to keep all socket-related code in + // wxNet instead of having to pull it in wxBase itself as we'd have to do + // if we really implemented GSocketManager here + // + // we don't take ownership of this pointer, it should have a lifetime + // greater than that of any socket (e.g. be a pointer to a static object) + static void SetDefaultSocketManager(GSocketManager *manager) + { + ms_manager = manager; + } + + virtual GSocketManager *GetSocketManager() { return ms_manager; } +#endif // wxUSE_SOCKETS + protected: // implementation of WaitForThread() for the console applications which is // also used by the GUI code if it doesn't [yet|already} dispatch events WXDWORD DoSimpleWaitForThread(WXHANDLE hThread); + + static GSocketManager *ms_manager; }; #endif // _WX_MSW_APPTBASE_H_ diff --git a/include/wx/msw/gsockmsw.h b/include/wx/msw/gsockmsw.h index f7970f6ffd..fb4be23571 100644 --- a/include/wx/msw/gsockmsw.h +++ b/include/wx/msw/gsockmsw.h @@ -8,20 +8,8 @@ * ------------------------------------------------------------------------- */ -#ifndef __GSOCK_MSW_H -#define __GSOCK_MSW_H - -#ifndef __GSOCKET_STANDALONE__ -#include "wx/setup.h" -#endif - -#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) - -#ifndef __GSOCKET_STANDALONE__ -#include "wx/gsocket.h" -#else -#include "gsocket.h" -#endif +#ifndef _WX_MSW_GSOCKMSW_H_ +#define _WX_MSW_GSOCKMSW_H_ #include "wx/msw/wrapwin.h" @@ -35,18 +23,6 @@ #include #endif -class GSocketGUIFunctionsTableConcrete: public GSocketGUIFunctionsTable -{ -public: - virtual bool OnInit(); - virtual void OnExit(); - virtual bool CanUseEventLoop(); - virtual bool Init_Socket(GSocket *socket); - virtual void Destroy_Socket(GSocket *socket); - virtual void Enable_Events(GSocket *socket); - virtual void Disable_Events(GSocket *socket); -}; - /* Definition of GSocket */ class GSocket { @@ -62,6 +38,8 @@ public: GAddress *GetPeer(); GSocketError SetServer(); GSocket *WaitConnection(); + // not used under MSW + void Notify(bool) { } bool SetReusable(); bool SetBroadcast(); bool DontDoBind(); @@ -123,10 +101,6 @@ public: int m_msgnumber; }; -#ifdef __cplusplus -extern "C" { -#endif - /* Definition of GAddress */ struct _GAddress { @@ -149,10 +123,4 @@ GSocketError _GAddress_translate_to (GAddress *address, GSocketError _GAddress_Init_INET(GAddress *address); GSocketError _GAddress_Init_UNIX(GAddress *address); -#ifdef __cplusplus -} -#endif - -#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ - -#endif /* __GSOCK_MSW_H */ +#endif /* _WX_MSW_GSOCKMSW_H_ */ diff --git a/include/wx/private/gsocketiohandler.h b/include/wx/private/gsocketiohandler.h index 135e938d2a..00c4cf3ea9 100644 --- a/include/wx/private/gsocketiohandler.h +++ b/include/wx/private/gsocketiohandler.h @@ -2,7 +2,6 @@ // Name: wx/private/gsocketiohandler.h // Purpose: class for registering GSocket in wxSelectDispatcher // Authors: Lukasz Michalski -// Modified by: // Created: December 2006 // Copyright: (c) Lukasz Michalski // RCS-ID: $Id$ @@ -13,30 +12,34 @@ #define _WX_PRIVATE_GSOCKETIOHANDLER_H_ #include "wx/defs.h" -#include "wx/private/selectdispatcher.h" -#if wxUSE_SOCKETS +#if wxUSE_SOCKETS && wxUSE_SELECT_DISPATCHER -// forward declarations -class GSocket; +#include "wx/private/selectdispatcher.h" +#include "wx/gsocket.h" -class WXDLLIMPEXP_CORE wxGSocketIOHandler : public wxFDIOHandler +class WXDLLIMPEXP_BASE wxGSocketIOHandler : public wxFDIOHandler { public: - wxGSocketIOHandler(GSocket* socket); - int GetFlags() const; - void RemoveFlag(wxFDIODispatcherEntryFlags flag); - void AddFlag(wxFDIODispatcherEntryFlags flag); + wxGSocketIOHandler(GSocket* socket) + { + m_socket = socket; + m_flags = 0; + } + + int GetFlags() const { return m_flags; } + void RemoveFlag(wxFDIODispatcherEntryFlags flag) { m_flags &= ~flag; } + void AddFlag(wxFDIODispatcherEntryFlags flag) { m_flags |= flag; } - virtual void OnReadWaiting(); - virtual void OnWriteWaiting(); - virtual void OnExceptionWaiting(); + virtual void OnReadWaiting() { m_socket->Detected_Read(); } + virtual void OnWriteWaiting() { m_socket->Detected_Write(); } + virtual void OnExceptionWaiting() { m_socket->Detected_Read(); } private: GSocket* m_socket; int m_flags; }; -#endif // wxUSE_SOCKETS +#endif // wxUSE_SOCKETS && wxUSE_SELECT_DISPATCHER #endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_ diff --git a/include/wx/unix/apptbase.h b/include/wx/unix/apptbase.h index 319efeeb09..50f30040f8 100644 --- a/include/wx/unix/apptbase.h +++ b/include/wx/unix/apptbase.h @@ -48,6 +48,13 @@ public: // ---------------- // TODO + +#if wxUSE_SOCKETS + // returns the select()-based socket manager for console applications which + // is also used by some ports (wxX11, wxDFB) in the GUI build (hence it is + // here and not in wxConsoleAppTraits) + virtual GSocketManager *GetSocketManager(); +#endif }; #endif // _WX_UNIX_APPTBASE_H_ diff --git a/include/wx/unix/apptrait.h b/include/wx/unix/apptrait.h index 25b0ba9526..fe5639731a 100644 --- a/include/wx/unix/apptrait.h +++ b/include/wx/unix/apptrait.h @@ -67,6 +67,17 @@ public: #if defined(__WXDEBUG__) && defined(__WXGTK20__) virtual bool ShowAssertDialog(const wxString& msg); #endif + + // GTK+ and Motif integrate sockets directly in their main loop, the other + // Unix ports do it at wxEventLoop level + // + // TODO: Should we use XtAddInput() for wxX11 too? Or, vice versa, if there + // is no advantage in doing this compared to the generic way + // currently used by wxX11, should we continue to use GTK/Motif- + // specific stuff? +#if wxUSE_SOCKETS && (defined(__WXGTK__) || defined(__WXMOTIF__)) + virtual GSocketManager *GetSocketManager(); +#endif }; #endif // wxUSE_GUI diff --git a/include/wx/unix/gsockunx.h b/include/wx/unix/gsockunx.h index c1a42f2b8c..a6182dc0d4 100644 --- a/include/wx/unix/gsockunx.h +++ b/include/wx/unix/gsockunx.h @@ -8,37 +8,11 @@ * ------------------------------------------------------------------------- */ -#ifndef __GSOCK_UNX_H -#define __GSOCK_UNX_H - -#ifndef __GSOCKET_STANDALONE__ -#include "wx/setup.h" -#endif +#ifndef _WX_UNIX_GSOCKUNX_H_ +#define _WX_UNIX_GSOCKUNX_H_ class wxGSocketIOHandler; -#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) - -#ifndef __GSOCKET_STANDALONE__ -#include "wx/gsocket.h" -#else -#include "gsocket.h" -#endif - -class GSocketGUIFunctionsTableConcrete : public GSocketGUIFunctionsTable -{ -public: - virtual bool OnInit(); - virtual void OnExit(); - virtual bool CanUseEventLoop(); - virtual bool Init_Socket(GSocket *socket); - virtual void Destroy_Socket(GSocket *socket); - virtual void Install_Callback(GSocket *socket, GSocketEvent event); - virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event); - virtual void Enable_Events(GSocket *socket); - virtual void Disable_Events(GSocket *socket); -}; - class GSocket { public: @@ -70,6 +44,8 @@ public: GSocketError GetSockOpt(int level, int optname, void *optval, int *optlen); GSocketError SetSockOpt(int level, int optname, const void *optval, int optlen); + //attach or detach from main loop + void Notify(bool flag); virtual void Detected_Read(); virtual void Detected_Write(); void SetInitialSocketBuffers(int recv, int send) @@ -79,6 +55,9 @@ public: } protected: + //enable or disable event callback using gsocket gui callback table + void EnableEvents(bool flag = true); + void DisableEvents() { EnableEvents(false); } void Enable(GSocketEvent event); void Disable(GSocketEvent event); GSocketError Input_Timeout(); @@ -108,18 +87,18 @@ public: bool m_dobind; unsigned long m_timeout; + // true if socket should fire events + bool m_use_events; + /* Callbacks */ GSocketEventFlags m_detected; GSocketCallback m_cbacks[GSOCK_MAX_EVENT]; char *m_data[GSOCK_MAX_EVENT]; - char *m_gui_dependent; - + // pointer for storing extra (usually GUI-specific) data + void *m_gui_dependent; }; -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ /* Definition of GAddress */ struct _GAddress { @@ -131,15 +110,6 @@ struct _GAddress GSocketError m_error; }; -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - /* GAddress */ @@ -150,11 +120,121 @@ GSocketError _GAddress_translate_to (GAddress *address, GSocketError _GAddress_Init_INET(GAddress *address); GSocketError _GAddress_Init_UNIX(GAddress *address); +// A version of GSocketManager which uses FDs for socket IO +// +// This class uses GSocket::m_gui_dependent field to store the 2 (for input and +// output) FDs associated with the socket. +class GSocketFDBasedManager : public GSocketManager +{ +public: + // no special initialization/cleanup needed when using FDs + virtual bool OnInit() { return true; } + virtual void OnExit() { } + + // allocate/free the storage we need + virtual bool Init_Socket(GSocket *socket) + { + socket->m_gui_dependent = malloc(sizeof(int)*2); + int * const fds = wx_static_cast(int *, socket->m_gui_dependent); + + fds[0] = -1; + fds[1] = -1; -#ifdef __cplusplus -} -#endif /* __cplusplus */ + return true; + } + virtual void Destroy_Socket(GSocket *socket) + { + free(socket->m_gui_dependent); + } -#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ + virtual void Enable_Events(GSocket *socket) + { + Install_Callback(socket, GSOCK_INPUT); + Install_Callback(socket, GSOCK_OUTPUT); + } + virtual void Disable_Events(GSocket *socket) + { + Uninstall_Callback(socket, GSOCK_INPUT); + Uninstall_Callback(socket, GSOCK_OUTPUT); + } + +protected: + // identifies either input or output direction + // + // NB: the values of this enum shouldn't change + enum SocketDir + { + FD_INPUT, + FD_OUTPUT + }; + + // get the FD index corresponding to the given GSocketEvent + SocketDir GetDirForEvent(GSocket *socket, GSocketEvent event) + { + switch ( event ) + { + default: + wxFAIL_MSG( "unexpected socket event" ); + // fall through + + case GSOCK_LOST: + // fall through + + case GSOCK_INPUT: + return FD_INPUT; + + case GSOCK_OUTPUT: + return FD_OUTPUT; + + case GSOCK_CONNECTION: + // FIXME: explain this? + return socket->m_server ? FD_INPUT : FD_OUTPUT; + } + } + + // access the FDs we store + int& FD(GSocket *socket, SocketDir d) + { + return wx_static_cast(int *, socket->m_gui_dependent)[d]; + } +}; + +// Common base class for all ports using X11-like (and hence implemented in +// X11, Motif and GTK) AddInput() and RemoveInput() functions +class GSocketInputBasedManager : public GSocketFDBasedManager +{ +public: + virtual void Install_Callback(GSocket *socket, GSocketEvent event) + { + wxCHECK_RET( socket->m_fd != -1, + "shouldn't be called on invalid socket" ); + + const SocketDir d = GetDirForEvent(socket, event); + + int& fd = FD(socket, d); + if ( fd != -1 ) + RemoveInput(fd); + + fd = AddInput(socket, d); + } + + virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event) + { + const SocketDir d = GetDirForEvent(socket, event); + + int& fd = FD(socket, d); + if ( fd != -1 ) + { + RemoveInput(fd); + fd = -1; + } + } + +private: + // these functions map directly to XtAdd/RemoveInput() or + // gdk_input_add/remove() + virtual int AddInput(GSocket *socket, SocketDir d) = 0; + virtual void RemoveInput(int fd) = 0; +}; -#endif /* __GSOCK_UNX_H */ +#endif /* _WX_UNIX_GSOCKUNX_H_ */ diff --git a/samples/sockets/Makefile.in b/samples/sockets/Makefile.in index ddef51879b..615332be3f 100644 --- a/samples/sockets/Makefile.in +++ b/samples/sockets/Makefile.in @@ -59,6 +59,18 @@ SERVER_OBJECTS = \ $(os2_lib_res) \ server_server.o \ $(__server___win32rc) +BASECLIENT_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ + $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \ + -I$(srcdir) $(__DLLFLAG_p) -DwxUSE_GUI=0 $(CXXWARNINGS) $(CPPFLAGS) \ + $(CXXFLAGS) +BASECLIENT_OBJECTS = \ + baseclient_baseclient.o +BASESERVER_CXXFLAGS = -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \ + $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) \ + -I$(srcdir) $(__DLLFLAG_p) -DwxUSE_GUI=0 $(CXXWARNINGS) $(CPPFLAGS) \ + $(CXXFLAGS) +BASESERVER_OBJECTS = \ + baseserver_baseserver.o ### Conditionally set variables: ### @@ -75,6 +87,7 @@ SERVER_OBJECTS = \ @COND_MONOLITHIC_1@EXTRALIBS_FOR_BASE = $(EXTRALIBS) $(EXTRALIBS_GUI) @COND_MONOLITHIC_0@EXTRALIBS_FOR_GUI = $(EXTRALIBS_GUI) @COND_MONOLITHIC_1@EXTRALIBS_FOR_GUI = +@COND_USE_GUI_1@__client___depname = client$(EXEEXT) @COND_PLATFORM_MAC_1@__client___mac_setfilecmd = \ @COND_PLATFORM_MAC_1@ $(SETFILE) -a C client$(EXEEXT) @COND_PLATFORM_MAC_1@__client___mac_rezcmd = $(__MACOSX_RESOURCES_p_2) @@ -87,6 +100,7 @@ COND_PLATFORM_OS2_1___client___os2_emxbindcmd = $(NM) client$(EXEEXT) | if grep @COND_TOOLKIT_MAC@____client_BUNDLE_TGT_REF_DEP = \ @COND_TOOLKIT_MAC@ client.app/Contents/PkgInfo @COND_PLATFORM_WIN32_1@__client___win32rc = client_client_rc.o +@COND_USE_GUI_1@__server___depname = server$(EXEEXT) @COND_PLATFORM_MAC_1@__server___mac_setfilecmd = \ @COND_PLATFORM_MAC_1@ $(SETFILE) -a C server$(EXEEXT) @COND_PLATFORM_MAC_1@__server___mac_rezcmd = $(__MACOSX_RESOURCES_p_3) @@ -99,6 +113,10 @@ COND_PLATFORM_OS2_1___server___os2_emxbindcmd = $(NM) server$(EXEEXT) | if grep @COND_TOOLKIT_MAC@____server_BUNDLE_TGT_REF_DEP = \ @COND_TOOLKIT_MAC@ server.app/Contents/PkgInfo @COND_PLATFORM_WIN32_1@__server___win32rc = server_server_rc.o +@COND_PLATFORM_MAC_1@__baseclient___mac_setfilecmd = \ +@COND_PLATFORM_MAC_1@ $(SETFILE) -t APPL baseclient$(EXEEXT) +@COND_PLATFORM_MAC_1@__baseserver___mac_setfilecmd = \ +@COND_PLATFORM_MAC_1@ $(SETFILE) -t APPL baseserver$(EXEEXT) COND_TOOLKIT_MAC___MACOSX_RESOURCES_p_2 = $(REZ) -d __DARWIN__ -t APPL -d \ __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) \ $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) -i $(srcdir) $(__DLLFLAG_p_0) -i \ @@ -111,21 +129,16 @@ COND_TOOLKIT_MAC___MACOSX_RESOURCES_p_3 = $(REZ) -d __DARWIN__ -t APPL -d \ $(srcdir)/../../samples $(__RCDEFDIR_p) -i $(top_srcdir)/include -o \ server$(EXEEXT) Carbon.r sample.r @COND_TOOLKIT_MAC@__MACOSX_RESOURCES_p_3 = $(COND_TOOLKIT_MAC___MACOSX_RESOURCES_p_3) -@COND_WXUNIV_1@__WXUNIV_DEFINE_p = -D__WXUNIVERSAL__ @COND_WXUNIV_1@__WXUNIV_DEFINE_p_0 = -d __WXUNIVERSAL__ -@COND_WXUNIV_1@__WXUNIV_DEFINE_p_6 = --define __WXUNIVERSAL__ -@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS +@COND_WXUNIV_1@__WXUNIV_DEFINE_p_7 = --define __WXUNIVERSAL__ @COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p_0 = -d wxNO_EXCEPTIONS -@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p_6 = --define wxNO_EXCEPTIONS -@COND_USE_RTTI_0@__RTTI_DEFINE_p = -DwxNO_RTTI +@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p_7 = --define wxNO_EXCEPTIONS @COND_USE_RTTI_0@__RTTI_DEFINE_p_0 = -d wxNO_RTTI -@COND_USE_RTTI_0@__RTTI_DEFINE_p_6 = --define wxNO_RTTI -@COND_USE_THREADS_0@__THREAD_DEFINE_p = -DwxNO_THREADS +@COND_USE_RTTI_0@__RTTI_DEFINE_p_7 = --define wxNO_RTTI @COND_USE_THREADS_0@__THREAD_DEFINE_p_0 = -d wxNO_THREADS -@COND_USE_THREADS_0@__THREAD_DEFINE_p_6 = --define wxNO_THREADS -@COND_SHARED_1@__DLLFLAG_p = -DWXUSINGDLL +@COND_USE_THREADS_0@__THREAD_DEFINE_p_7 = --define wxNO_THREADS @COND_SHARED_1@__DLLFLAG_p_0 = -d WXUSINGDLL -@COND_SHARED_1@__DLLFLAG_p_6 = --define WXUSINGDLL +@COND_SHARED_1@__DLLFLAG_p_7 = --define WXUSINGDLL @COND_TOOLKIT_MSW@__RCDEFDIR_p = -i \ @COND_TOOLKIT_MSW@ $(LIBDIRNAME)/wx/include/$(TOOLCHAIN_FULLNAME) @COND_TOOLKIT_MSW@__RCDEFDIR_p_0 = --include-dir \ @@ -134,15 +147,6 @@ COND_TOOLKIT_MAC___MACOSX_RESOURCES_p_3 = $(REZ) -d __DARWIN__ -t APPL -d \ COND_MONOLITHIC_0___WXLIB_CORE_p = \ -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX) @COND_MONOLITHIC_0@__WXLIB_CORE_p = $(COND_MONOLITHIC_0___WXLIB_CORE_p) -COND_MONOLITHIC_0___WXLIB_NET_p = \ - -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net-$(WX_RELEASE)$(HOST_SUFFIX) -@COND_MONOLITHIC_0@__WXLIB_NET_p = $(COND_MONOLITHIC_0___WXLIB_NET_p) -COND_MONOLITHIC_0___WXLIB_BASE_p = \ - -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) -@COND_MONOLITHIC_0@__WXLIB_BASE_p = $(COND_MONOLITHIC_0___WXLIB_BASE_p) -COND_MONOLITHIC_1___WXLIB_MONO_p = \ - -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) -@COND_MONOLITHIC_1@__WXLIB_MONO_p = $(COND_MONOLITHIC_1___WXLIB_MONO_p) @COND_USE_GUI_1_WXUSE_LIBTIFF_BUILTIN@__LIB_TIFF_p \ @COND_USE_GUI_1_WXUSE_LIBTIFF_BUILTIN@ = \ @COND_USE_GUI_1_WXUSE_LIBTIFF_BUILTIN@ -lwxtiff$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) @@ -152,6 +156,20 @@ COND_MONOLITHIC_1___WXLIB_MONO_p = \ @COND_USE_GUI_1_WXUSE_LIBPNG_BUILTIN@__LIB_PNG_p \ @COND_USE_GUI_1_WXUSE_LIBPNG_BUILTIN@ = \ @COND_USE_GUI_1_WXUSE_LIBPNG_BUILTIN@ -lwxpng$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) +@COND_WXUNIV_1@__WXUNIV_DEFINE_p = -D__WXUNIVERSAL__ +@COND_USE_EXCEPTIONS_0@__EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS +@COND_USE_RTTI_0@__RTTI_DEFINE_p = -DwxNO_RTTI +@COND_USE_THREADS_0@__THREAD_DEFINE_p = -DwxNO_THREADS +@COND_SHARED_1@__DLLFLAG_p = -DWXUSINGDLL +COND_MONOLITHIC_0___WXLIB_NET_p = \ + -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net-$(WX_RELEASE)$(HOST_SUFFIX) +@COND_MONOLITHIC_0@__WXLIB_NET_p = $(COND_MONOLITHIC_0___WXLIB_NET_p) +COND_MONOLITHIC_0___WXLIB_BASE_p = \ + -lwx_base$(WXBASEPORT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) +@COND_MONOLITHIC_0@__WXLIB_BASE_p = $(COND_MONOLITHIC_0___WXLIB_BASE_p) +COND_MONOLITHIC_1___WXLIB_MONO_p = \ + -lwx_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) +@COND_MONOLITHIC_1@__WXLIB_MONO_p = $(COND_MONOLITHIC_1___WXLIB_MONO_p) @COND_WXUSE_ZLIB_BUILTIN@__LIB_ZLIB_p = \ @COND_WXUSE_ZLIB_BUILTIN@ -lwxzlib$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX) COND_WXUSE_REGEX_BUILTIN___LIB_REGEX_p = \ @@ -162,7 +180,7 @@ COND_WXUSE_REGEX_BUILTIN___LIB_REGEX_p = \ ### Targets: ### -all: client$(EXEEXT) $(__client_bundle___depname) server$(EXEEXT) $(__server_bundle___depname) +all: $(__client___depname) $(__client_bundle___depname) $(__server___depname) $(__server_bundle___depname) baseclient$(EXEEXT) baseserver$(EXEEXT) install: all @@ -177,18 +195,20 @@ clean: rm -rf client.app rm -f server$(EXEEXT) rm -rf server.app + rm -f baseclient$(EXEEXT) + rm -f baseserver$(EXEEXT) distclean: clean rm -f config.cache config.log config.status bk-deps bk-make-pch shared-ld-sh Makefile -client$(EXEEXT): $(CLIENT_OBJECTS) $(__client___win32rc) - $(CXX) -o $@ $(CLIENT_OBJECTS) $(LDFLAGS) -L$(LIBDIRNAME) $(LDFLAGS_GUI) $(SAMPLES_RPATH_FLAG) $(LIBS) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) - $(__client___mac_rezcmd) - $(__client___mac_setfilecmd) - $(__client___os2_emxbindcmd) - $(SAMPLES_RPATH_POSTLINK) +@COND_USE_GUI_1@client$(EXEEXT): $(CLIENT_OBJECTS) $(__client___win32rc) +@COND_USE_GUI_1@ $(CXX) -o $@ $(CLIENT_OBJECTS) $(LDFLAGS) -L$(LIBDIRNAME) $(LDFLAGS_GUI) $(SAMPLES_RPATH_FLAG) $(LIBS) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) +@COND_USE_GUI_1@ $(__client___mac_rezcmd) +@COND_USE_GUI_1@ $(__client___mac_setfilecmd) +@COND_USE_GUI_1@ $(__client___os2_emxbindcmd) +@COND_USE_GUI_1@ $(SAMPLES_RPATH_POSTLINK) -client.app/Contents/PkgInfo: client$(EXEEXT) $(top_srcdir)/src/mac/carbon/Info.plist.in $(top_srcdir)/src/mac/carbon/wxmac.icns +client.app/Contents/PkgInfo: $(__client___depname) $(top_srcdir)/src/mac/carbon/Info.plist.in $(top_srcdir)/src/mac/carbon/wxmac.icns mkdir -p client.app/Contents mkdir -p client.app/Contents/MacOS mkdir -p client.app/Contents/Resources @@ -210,14 +230,14 @@ client.app/Contents/PkgInfo: client$(EXEEXT) $(top_srcdir)/src/mac/carbon/Info.p @COND_PLATFORM_MACOSX_1@client_bundle: $(____client_BUNDLE_TGT_REF_DEP) -server$(EXEEXT): $(SERVER_OBJECTS) $(__server___win32rc) - $(CXX) -o $@ $(SERVER_OBJECTS) $(LDFLAGS) -L$(LIBDIRNAME) $(LDFLAGS_GUI) $(SAMPLES_RPATH_FLAG) $(LIBS) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) - $(__server___mac_rezcmd) - $(__server___mac_setfilecmd) - $(__server___os2_emxbindcmd) - $(SAMPLES_RPATH_POSTLINK) +@COND_USE_GUI_1@server$(EXEEXT): $(SERVER_OBJECTS) $(__server___win32rc) +@COND_USE_GUI_1@ $(CXX) -o $@ $(SERVER_OBJECTS) $(LDFLAGS) -L$(LIBDIRNAME) $(LDFLAGS_GUI) $(SAMPLES_RPATH_FLAG) $(LIBS) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) +@COND_USE_GUI_1@ $(__server___mac_rezcmd) +@COND_USE_GUI_1@ $(__server___mac_setfilecmd) +@COND_USE_GUI_1@ $(__server___os2_emxbindcmd) +@COND_USE_GUI_1@ $(SAMPLES_RPATH_POSTLINK) -server.app/Contents/PkgInfo: server$(EXEEXT) $(top_srcdir)/src/mac/carbon/Info.plist.in $(top_srcdir)/src/mac/carbon/wxmac.icns +server.app/Contents/PkgInfo: $(__server___depname) $(top_srcdir)/src/mac/carbon/Info.plist.in $(top_srcdir)/src/mac/carbon/wxmac.icns mkdir -p server.app/Contents mkdir -p server.app/Contents/MacOS mkdir -p server.app/Contents/Resources @@ -239,17 +259,35 @@ server.app/Contents/PkgInfo: server$(EXEEXT) $(top_srcdir)/src/mac/carbon/Info.p @COND_PLATFORM_MACOSX_1@server_bundle: $(____server_BUNDLE_TGT_REF_DEP) +baseclient$(EXEEXT): $(BASECLIENT_OBJECTS) + $(CXX) -o $@ $(BASECLIENT_OBJECTS) $(LDFLAGS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LIBS) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) + + $(__baseclient___mac_setfilecmd) + $(SAMPLES_RPATH_POSTLINK) + +baseserver$(EXEEXT): $(BASESERVER_OBJECTS) + $(CXX) -o $@ $(BASESERVER_OBJECTS) $(LDFLAGS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LIBS) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) + + $(__baseserver___mac_setfilecmd) + $(SAMPLES_RPATH_POSTLINK) + client_client.o: $(srcdir)/client.cpp $(CXXC) -c -o $@ $(CLIENT_CXXFLAGS) $(srcdir)/client.cpp client_client_rc.o: $(srcdir)/client.rc - $(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_6) $(__EXCEPTIONS_DEFINE_p_6) $(__RTTI_DEFINE_p_6) $(__THREAD_DEFINE_p_6) --include-dir $(srcdir) $(__DLLFLAG_p_6) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p_0) --include-dir $(top_srcdir)/include + $(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_7) $(__EXCEPTIONS_DEFINE_p_7) $(__RTTI_DEFINE_p_7) $(__THREAD_DEFINE_p_7) --include-dir $(srcdir) $(__DLLFLAG_p_7) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p_0) --include-dir $(top_srcdir)/include server_server.o: $(srcdir)/server.cpp $(CXXC) -c -o $@ $(SERVER_CXXFLAGS) $(srcdir)/server.cpp server_server_rc.o: $(srcdir)/server.rc - $(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_6) $(__EXCEPTIONS_DEFINE_p_6) $(__RTTI_DEFINE_p_6) $(__THREAD_DEFINE_p_6) --include-dir $(srcdir) $(__DLLFLAG_p_6) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p_0) --include-dir $(top_srcdir)/include + $(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_7) $(__EXCEPTIONS_DEFINE_p_7) $(__RTTI_DEFINE_p_7) $(__THREAD_DEFINE_p_7) --include-dir $(srcdir) $(__DLLFLAG_p_7) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p_0) --include-dir $(top_srcdir)/include + +baseclient_baseclient.o: $(srcdir)/baseclient.cpp + $(CXXC) -c -o $@ $(BASECLIENT_CXXFLAGS) $(srcdir)/baseclient.cpp + +baseserver_baseserver.o: $(srcdir)/baseserver.cpp + $(CXXC) -c -o $@ $(BASESERVER_CXXFLAGS) $(srcdir)/baseserver.cpp # Include dependency info, if present: diff --git a/samples/sockets/baseclient.cpp b/samples/sockets/baseclient.cpp new file mode 100644 index 0000000000..f9ce6c6f9a --- /dev/null +++ b/samples/sockets/baseclient.cpp @@ -0,0 +1,733 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: samples/sockbase/client.cpp +// Purpose: Sockets sample for wxBase +// Author: Lukasz Michalski +// Modified by: +// Created: 27.06.2005 +// RCS-ID: $Id$ +// Copyright: (c) 2005 Lukasz Michalski +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/wx.h" +#include "wx/socket.h" +#include "wx/event.h" +#include "wx/list.h" +#include "wx/cmdline.h" +#include "wx/ffile.h" +#include "wx/datetime.h" +#include "wx/timer.h" +#include "wx/thread.h" + +const wxEventType wxEVT_WORKER = wxNewEventType(); +#define EVT_WORKER(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_WORKER, -1, -1, (wxObjectEventFunction) (wxEventFunction) (WorkerEventFunction) & func, (wxObject *) NULL ), + +const int timeout_val = 1000; + +class WorkerEvent : public wxEvent { +public: + typedef enum { + CONNECTING, + SENDING, + RECEIVING, + DISCONNECTING, + DONE + } evt_type; + WorkerEvent(void* pSender, evt_type type) + { + SetId(-1); + SetEventType(wxEVT_WORKER); + m_sender = pSender; + m_eventType = type; + m_isFailed = false; + } + + void setFailed() { m_isFailed = true; } + bool isFailed() const { return m_isFailed; } + + virtual wxEvent* Clone() const + { + return new WorkerEvent(*this); + } + void* m_sender; + bool m_isFailed; + wxString m_workerIdent; + evt_type m_eventType; +}; + +typedef void (wxEvtHandler::*WorkerEventFunction)(WorkerEvent&); + +class ThreadWorker; +class EventWorker; + +WX_DECLARE_LIST(ThreadWorker, TList); +WX_DECLARE_LIST(EventWorker, EList); + +class Client : public wxApp { + DECLARE_EVENT_TABLE(); +public: + void RemoveEventWorker(EventWorker* p_worker); +private: + typedef enum + { + THREADS, + EVENTS + } workMode; + + typedef enum + { + SEND_RANDOM, + SEND_MESSAGE, + STRESS_TEST + } sendType; + + workMode m_workMode; + sendType m_sendType; + wxString m_message; + wxString m_host; + long m_stressWorkers; + + virtual bool OnInit(); + virtual int OnRun(); + virtual int OnExit(); + void OnInitCmdLine(wxCmdLineParser& pParser); + bool OnCmdLineParsed(wxCmdLineParser& pParser); + void OnWorkerEvent(WorkerEvent& pEvent); + void OnTimerEvent(wxTimerEvent& pEvent); + + void StartWorker(workMode pMode, const wxString& pMessage); + void StartWorker(workMode pMode); + char* CreateBuffer(int *msgsize); + + void dumpStatistics(); + + TList m_threadWorkers; + EList m_eventWorkers; + + unsigned m_statConnecting; + unsigned m_statSending; + unsigned m_statReceiving; + unsigned m_statDisconnecting; + unsigned m_statDone; + unsigned m_statFailed; + + wxTimer mTimer; +}; + +DECLARE_APP(Client); + +class ThreadWorker : public wxThread +{ +public: + ThreadWorker(const wxString& p_host, char* p_buf, int p_size); + virtual ExitCode Entry(); +private: + wxString m_host; + wxSocketClient* m_clientSocket; + char* m_inbuf; + char* m_outbuf; + int m_outsize; + int m_insize; + wxString m_workerIdent; +}; + +class EventWorker : public wxEvtHandler +{ + DECLARE_EVENT_TABLE(); +public: + EventWorker(const wxString& p_host, char* p_buf, int p_size); + void Run(); + virtual ~EventWorker(); +private: + wxString m_host; + wxSocketClient* m_clientSocket; + char* m_inbuf; + char* m_outbuf; + int m_outsize; + int m_written; + int m_insize; + int m_readed; + + WorkerEvent::evt_type m_currentType; + bool m_doneSent; + wxIPV4address m_localaddr; + + void OnSocketEvent(wxSocketEvent& pEvent); + void SendEvent(bool failed); +}; + +/******************* Implementation ******************/ +IMPLEMENT_APP_CONSOLE(Client); + +#include +WX_DEFINE_LIST(TList); +WX_DEFINE_LIST(EList); + +wxString +CreateIdent(const wxIPV4address& addr) +{ + return wxString::Format(wxT("%s:%d"),addr.IPAddress().c_str(),addr.Service()); +} + +void +Client::OnInitCmdLine(wxCmdLineParser& pParser) +{ + wxApp::OnInitCmdLine(pParser); + pParser.AddSwitch(wxT("e"),wxT("event"),_("Use event based worker (default)"),wxCMD_LINE_PARAM_OPTIONAL); + pParser.AddSwitch(wxT("t"),wxT("thread"),_("Use thread based worker"),wxCMD_LINE_PARAM_OPTIONAL); + pParser.AddSwitch(wxT("r"),wxT("random"),_("Send radnom data (default)"),wxCMD_LINE_PARAM_OPTIONAL); + pParser.AddOption(wxT("m"),wxT("message"),_("Send message from "),wxCMD_LINE_VAL_STRING,wxCMD_LINE_PARAM_OPTIONAL); + pParser.AddOption(wxT("f"),wxT("file"),_("Send contents of "),wxCMD_LINE_VAL_STRING,wxCMD_LINE_PARAM_OPTIONAL); + pParser.AddOption(wxT("H"),wxT("hostname"),_("IP or name of host to connect to"),wxCMD_LINE_VAL_STRING,wxCMD_LINE_PARAM_OPTIONAL); + pParser.AddOption(wxT("s"),wxT("stress"),_("stress test with concurrent connections"),wxCMD_LINE_VAL_NUMBER,wxCMD_LINE_PARAM_OPTIONAL); +} + + +bool +Client::OnCmdLineParsed(wxCmdLineParser& pParser) +{ + wxString fname; + m_workMode = EVENTS; + m_stressWorkers = 50; + + if (pParser.Found(_("verbose"))) + { + wxLog::AddTraceMask(wxT("wxSocket")); + wxLog::AddTraceMask(wxT("epolldispatcher")); + wxLog::AddTraceMask(wxT("selectdispatcher")); + wxLog::AddTraceMask(wxT("thread")); + wxLog::AddTraceMask(wxT("events")); + } + + if (pParser.Found(wxT("t"))) + m_workMode = THREADS; + m_sendType = SEND_RANDOM; + + if (pParser.Found(wxT("m"),&m_message)) + m_sendType = SEND_MESSAGE; + else if (pParser.Found(wxT("f"),&fname)) + { + wxFFile file(fname); + if (!file.IsOpened()) { + wxLogError(wxT("Cannot open file %s"),fname.c_str()); + return false; + }; + if (!file.ReadAll(&m_message)) { + wxLogError(wxT("Cannot read conten of file %s"),fname.c_str()); + return false; + }; + m_sendType = SEND_MESSAGE; + }; + + if (pParser.Found(wxT("s"),&m_stressWorkers)) + m_sendType = STRESS_TEST; + + m_host = wxT("127.0.0.1"); + pParser.Found(wxT("H"),&m_host); + return wxApp::OnCmdLineParsed(pParser); +}; + +bool +Client::OnInit() +{ + if (!wxApp::OnInit()) + return false; + srand(wxDateTime::Now().GetTicks()); + mTimer.SetOwner(this); + m_statConnecting = 0; + m_statSending = 0; + m_statReceiving = 0; + m_statDisconnecting = 0; + m_statDone = 0; + m_statFailed = 0; + return true; +} + +int +Client::OnRun() +{ + switch(m_sendType) + { + case STRESS_TEST: + switch(m_workMode) + { + case THREADS: + for (int i = 0; i < m_stressWorkers; i++) { + if (m_message.empty()) + StartWorker(THREADS); + else + StartWorker(THREADS, m_message); + } + break; + case EVENTS: + for (int i = 0; i < m_stressWorkers; i++) { + if (m_message.empty()) + StartWorker(EVENTS); + else + StartWorker(EVENTS, m_message); + } + break; + default: + for (int i = 0; i < m_stressWorkers; i++) { + if (m_message.empty()) + StartWorker(i % 5 == 0 ? THREADS : EVENTS); + else + StartWorker(i % 5 == 0 ? THREADS : EVENTS, m_message); + } + break; + } + break; + case SEND_MESSAGE: + StartWorker(m_workMode,m_message); + break; + case SEND_RANDOM: + StartWorker(m_workMode); + break; + } + mTimer.Start(timeout_val,true); + return wxApp::OnRun(); +} + +int +Client::OnExit() +{ + for(EList::compatibility_iterator it = m_eventWorkers.GetFirst(); it ; it->GetNext()) { + delete it->GetData(); + } + return 0; +} + +// Create buffer to be sent by client. Buffer contains test indicator +// message size and place for data +// msgsize parameter contains size of data in bytes and +// if input value does not fit into 250 bytes then +// on exit is updated to new value that is multiply of 1024 bytes +char* +Client::CreateBuffer(int* msgsize) +{ + int bufsize = 0; + char* buf; + //if message should have more than 256 bytes then set it as + //test3 for compatibility with GUI server sample + if ((*msgsize) > 250) + { + //send at least one kb of data + int size = (*msgsize)/1024 + 1; + //returned buffer will contain test indicator, message size in kb and data + bufsize = size*1024+2; + buf = new char[bufsize]; + buf[0] = 0xDE; //second byte contains size in kilobytes + buf[1] = (char)(size); + *msgsize = size*1024; + } + else + { + //returned buffer will contain test indicator, message size in kb and data + bufsize = (*msgsize)+2; + buf = new char[bufsize]; + buf[0] = 0xBE; //second byte contains size in bytes + buf[1] = (char)(*msgsize); + } + return buf; +} + +void +Client::StartWorker(workMode pMode) { + int msgsize = 1 + (int) (250000.0 * (rand() / (RAND_MAX + 1.0))); + char* buf = CreateBuffer(&msgsize); + + //fill data part of buffer with random bytes + for (int i = 2; i < (msgsize); i++) { + buf[i] = i % 256; + } + + if (pMode == THREADS) { + ThreadWorker* c = new ThreadWorker(m_host,buf,msgsize+2); + if (c->Create() != wxTHREAD_NO_ERROR) { + wxLogError(wxT("Cannot create more threads")); + } else { + c->Run(); + m_threadWorkers.Append(c); + } + } else { + EventWorker* e = new EventWorker(m_host,buf,msgsize+2); + e->Run(); + m_eventWorkers.Append(e); + } + m_statConnecting++; +} + +void +Client::StartWorker(workMode pMode, const wxString& pMessage) { + char* tmpbuf = strdup(pMessage.mb_str()); + int msgsize = strlen(tmpbuf); + char* buf = CreateBuffer(&msgsize); + memset(buf+2,0x0,msgsize); + memcpy(buf+2,tmpbuf,msgsize); + free(tmpbuf); + + if (pMode == THREADS) { + ThreadWorker* c = new ThreadWorker(m_host,buf,msgsize+2); + if (c->Create() != wxTHREAD_NO_ERROR) { + wxLogError(wxT("Cannot create more threads")); + } else { + c->Run(); + m_threadWorkers.Append(c); + } + } else { + EventWorker* e = new EventWorker(m_host,buf,msgsize+2); + e->Run(); + m_eventWorkers.Append(e); + } + m_statConnecting++; +} + +void +Client::OnWorkerEvent(WorkerEvent& pEvent) { + switch (pEvent.m_eventType) { + case WorkerEvent::CONNECTING: + if (pEvent.isFailed()) + { + m_statConnecting--; + m_statFailed++; + } + break; + case WorkerEvent::SENDING: + if (pEvent.isFailed()) + { + m_statFailed++; + m_statSending--; + } + else + { + m_statConnecting--; + m_statSending++; + } + break; + case WorkerEvent::RECEIVING: + if (pEvent.isFailed()) + { + m_statReceiving--; + m_statFailed++; + } + else + { + m_statSending--; + m_statReceiving++; + } + break; + case WorkerEvent::DISCONNECTING: + if (pEvent.isFailed()) + { + m_statDisconnecting--; + m_statFailed++; + } + else + { + m_statReceiving--; + m_statDisconnecting++; + } + break; + case WorkerEvent::DONE: + m_statDone++; + m_statDisconnecting--; + break; + }; + + if (pEvent.isFailed() || pEvent.m_eventType == WorkerEvent::DONE) + { + for(TList::compatibility_iterator it = m_threadWorkers.GetFirst(); it ; it = it->GetNext()) { + if (it->GetData() == pEvent.m_sender) { + m_threadWorkers.DeleteNode(it); + break; + } + } + for(EList::compatibility_iterator it = m_eventWorkers.GetFirst(); it ; it = it->GetNext()) + { + if (it->GetData() == pEvent.m_sender) { + delete it->GetData(); + m_eventWorkers.DeleteNode(it); + break; + } + } + if ((m_threadWorkers.GetCount() == 0) && (m_eventWorkers.GetCount() == 0)) + { + mTimer.Stop(); + dumpStatistics(); + wxSleep(2); + ExitMainLoop(); + } + else + { + mTimer.Start(timeout_val,true); + } + } +} + +void +Client::RemoveEventWorker(EventWorker* p_worker) { + for(EList::compatibility_iterator it = m_eventWorkers.GetFirst(); it ; it = it->GetNext()) { + if (it->GetData() == p_worker) { + //wxLogDebug(wxT("Deleting event worker")); + delete it->GetData(); + m_eventWorkers.DeleteNode(it); + return; + } + } +} + +void +Client::dumpStatistics() { + wxString msg( + wxString::Format(_("Connecting:\t%d\nSending\t\t%d\nReceiving\t%d\nDisconnecting:\t%d\nDone:\t\t%d\nFailed:\t\t%d\n"), + m_statConnecting, + m_statSending, + m_statReceiving, + m_statDisconnecting, + m_statDone, + m_statFailed + )); + + wxLogMessage(wxT("Current status:\n%s\n"),msg.c_str()); +} + +void +Client::OnTimerEvent(wxTimerEvent&) { + dumpStatistics(); +} + +BEGIN_EVENT_TABLE(Client,wxEvtHandler) + EVT_WORKER(Client::OnWorkerEvent) + EVT_TIMER(wxID_ANY,Client::OnTimerEvent) +END_EVENT_TABLE() + + + +EventWorker::EventWorker(const wxString& p_host, char* p_buf, int p_size) + : m_host(p_host), + m_outbuf(p_buf), + m_outsize(p_size), + m_written(0), + m_readed(0) +{ + m_clientSocket = new wxSocketClient(wxSOCKET_NOWAIT); + m_clientSocket->SetEventHandler(*this); + m_insize = m_outsize - 2; + m_inbuf = new char[m_insize]; +} + +void +EventWorker::Run() { + wxIPV4address ca; + ca.Hostname(m_host); + ca.Service(3000); + m_clientSocket->SetNotify(wxSOCKET_CONNECTION_FLAG|wxSOCKET_LOST_FLAG|wxSOCKET_OUTPUT_FLAG|wxSOCKET_INPUT_FLAG); + m_clientSocket->Notify(true); + m_currentType = WorkerEvent::CONNECTING; + m_doneSent = false; + //wxLogMessage(wxT("EventWorker: Connecting.....")); + m_clientSocket->Connect(ca,false); +} + +void +EventWorker::OnSocketEvent(wxSocketEvent& pEvent) { + switch(pEvent.GetSocketEvent()) { + case wxSOCKET_INPUT: + //wxLogDebug(wxT("EventWorker: INPUT")); + do { + if (m_readed == m_insize) + return; //event already posted + m_clientSocket->Read(m_inbuf + m_readed, m_insize - m_readed); + if (m_clientSocket->Error()) + { + if (m_clientSocket->LastError() != wxSOCKET_WOULDBLOCK) + { + wxLogError(wxT("%s: read error"),CreateIdent(m_localaddr).c_str()); + SendEvent(true); + } + } + + m_readed += m_clientSocket->LastCount(); + //wxLogDebug(wxT("EventWorker: readed %d bytes, %d bytes to do"),m_clientSocket->LastCount(), m_insize - m_readed); + if (m_readed == m_insize) + { + if (!memcmp(m_inbuf,m_outbuf,m_insize)) { + wxLogError(wxT("%s: data mismatch"),CreateIdent(m_localaddr).c_str()); + SendEvent(true); + } + m_currentType = WorkerEvent::DISCONNECTING; + wxLogDebug(wxT("%s: DISCONNECTING"),CreateIdent(m_localaddr).c_str()); + SendEvent(false); + + //wxLogDebug(wxT("EventWorker %p closing"),this); + m_clientSocket->Close(); + + m_currentType = WorkerEvent::DONE; + wxLogDebug(wxT("%s: DONE"),CreateIdent(m_localaddr).c_str()); + SendEvent(false); + } + } while (!m_clientSocket->Error()); + break; + case wxSOCKET_OUTPUT: + //wxLogDebug(wxT("EventWorker: OUTPUT")); + do { + if (m_written == m_outsize) + return; + if (m_written == 0) + { + m_currentType = WorkerEvent::SENDING; + wxLogDebug(wxT("%s: SENDING"),CreateIdent(m_localaddr).c_str()); + } + m_clientSocket->Write(m_outbuf + m_written, m_outsize - m_written); + if (m_clientSocket->Error()) + { + if (m_clientSocket->LastError() != wxSOCKET_WOULDBLOCK) { + wxLogError(wxT("%s: Write error"),CreateIdent(m_localaddr).c_str()); + SendEvent(true); + } + } + m_written += m_clientSocket->LastCount(); + if (m_written != m_outsize) + { + //wxLogDebug(wxT("EventWorker: written %d bytes, %d bytes to do"),m_clientSocket->LastCount(),m_outsize - m_written); + } + else + { + //wxLogDebug(wxT("EventWorker %p SENDING->RECEIVING"),this); + m_currentType = WorkerEvent::RECEIVING; + wxLogDebug(wxT("%s: RECEIVING"),CreateIdent(m_localaddr).c_str()); + SendEvent(false); + } + } while(!m_clientSocket->Error()); + break; + case wxSOCKET_CONNECTION: + { + //wxLogMessage(wxT("EventWorker: got connection")); + wxLogMessage(wxT("%s: starting writing message (2 bytes for signature and %d bytes of data to write)"),CreateIdent(m_localaddr).c_str(),m_outsize-2); + if (!m_clientSocket->GetLocal(m_localaddr)) + wxLogError(_("Cannot get peer data for socket %p"),m_clientSocket); + m_currentType = WorkerEvent::SENDING; + wxLogDebug(wxT("%s: CONNECTING"),CreateIdent(m_localaddr).c_str()); + SendEvent(false); + } + break; + case wxSOCKET_LOST: + { + wxLogError(_("%s: connection lost"),CreateIdent(m_localaddr).c_str()); + SendEvent(true); + } + break; + } +} + +void +EventWorker::SendEvent(bool failed) { + if (m_doneSent) + return; + WorkerEvent e(this,m_currentType); + if (failed) e.setFailed(); + wxGetApp().AddPendingEvent(e); + m_doneSent = failed || m_currentType == WorkerEvent::DONE; +}; + +EventWorker::~EventWorker() { + m_clientSocket->Destroy(); + delete [] m_outbuf; + delete [] m_inbuf; +} + +BEGIN_EVENT_TABLE(EventWorker,wxEvtHandler) + EVT_SOCKET(wxID_ANY,EventWorker::OnSocketEvent) +END_EVENT_TABLE() + + +ThreadWorker::ThreadWorker(const wxString& p_host, char* p_buf, int p_size) + : wxThread(wxTHREAD_DETACHED), + m_host(p_host), + m_outbuf(p_buf), + m_outsize(p_size) +{ + m_clientSocket = new wxSocketClient(wxSOCKET_BLOCK|wxSOCKET_WAITALL); + m_insize = m_outsize - 2; + m_inbuf = new char[m_insize]; +} + +wxThread::ExitCode ThreadWorker::Entry() +{ + wxIPV4address ca; + ca.Hostname(m_host); + ca.Service(5678); + //wxLogDebug(wxT("ThreadWorker: Connecting.....")); + m_clientSocket->SetTimeout(60); + bool failed = false; + WorkerEvent::evt_type etype = WorkerEvent::CONNECTING; + if (!m_clientSocket->Connect(ca)) { + wxLogError(wxT("Cannot connect to %s:%d"),ca.IPAddress().c_str(), ca.Service()); + failed = true; + } else { + //wxLogMessage(wxT("ThreadWorker: Connected. Sending %d bytes of data"),m_outsize); + etype = WorkerEvent::SENDING; + WorkerEvent e(this,etype); + wxGetApp().AddPendingEvent(e); + int to_process = m_outsize; + do { + m_clientSocket->Write(m_outbuf,m_outsize); + if (m_clientSocket->Error()) { + wxLogError(wxT("ThreadWorker: Write error")); + failed = true; + } + to_process -= m_clientSocket->LastCount(); + //wxLogDebug(wxT("EventWorker: written %d bytes, %d bytes to do"),m_clientSocket->LastCount(),to_process); + } while(!m_clientSocket->Error() && to_process != 0); + + if (!failed) { + etype = WorkerEvent::RECEIVING; + WorkerEvent e(this,etype); + wxGetApp().AddPendingEvent(e); + to_process = m_insize; + do { + m_clientSocket->Read(m_inbuf,m_insize); + if (m_clientSocket->Error()) { + wxLogError(wxT("ThreadWorker: Read error")); + failed = true; + break; + } + to_process -= m_clientSocket->LastCount(); + //wxLogDebug(wxT("EventWorker: readed %d bytes, %d bytes to do"),m_clientSocket->LastCount(),to_process); + } while(!m_clientSocket->Error() && to_process != 0); + } + + char* outdat = (char*)m_outbuf+2; + if (!failed && (memcmp(m_inbuf,outdat,m_insize) != 0)) + { + wxLogError(wxT("Data mismatch")); + failed = true; + } + } + //wxLogDebug(wxT("ThreadWorker: Finished")); + if (!failed) { + etype = WorkerEvent::DISCONNECTING; + WorkerEvent e(this,etype); + wxGetApp().AddPendingEvent(e); + }; + m_clientSocket->Close(); + m_clientSocket->Destroy(); + m_clientSocket = NULL; + delete [] m_outbuf; + delete [] m_inbuf; + if (!failed) + etype = WorkerEvent::DONE; + WorkerEvent e(this,etype); + if (failed) e.setFailed(); + wxGetApp().AddPendingEvent(e); + return 0; +} + diff --git a/samples/sockets/baseserver.cpp b/samples/sockets/baseserver.cpp new file mode 100644 index 0000000000..ae511045fe --- /dev/null +++ b/samples/sockets/baseserver.cpp @@ -0,0 +1,738 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: samples/sockbase/client.cpp +// Purpose: Sockets sample for wxBase +// Author: Lukasz Michalski +// Modified by: +// Created: 27.06.2005 +// RCS-ID: $Id$ +// Copyright: (c) 2005 Lukasz Michalski +// Licence: wxWindows license +///////////////////////////////////////////////////////////////////////////// + +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- + +#include "wx/wx.h" +#include "wx/socket.h" +#include "wx/event.h" +#include "wx/list.h" +#include "wx/cmdline.h" +#include "wx/datetime.h" +#include "wx/timer.h" +#include "wx/thread.h" + +wxChar* GetSocketErrorMsg(int pSockError) +{ + switch(pSockError) + { + case wxSOCKET_NOERROR: + return wxT("wxSOCKET_NOERROR"); + break; + case wxSOCKET_INVOP: + return wxT("wxSOCKET_INVOP"); + break; + case wxSOCKET_IOERR: + return wxT("wxSOCKET_IOERR"); + break; + case wxSOCKET_INVADDR: + return wxT("wxSOCKET_INVADDR"); + break; + case wxSOCKET_NOHOST: + return wxT("wxSOCKET_NOHOST"); + break; + case wxSOCKET_INVPORT: + return wxT("wxSOCKET_INVPORT"); + break; + case wxSOCKET_WOULDBLOCK: + return wxT("wxSOCKET_WOULDBLOCK"); + break; + case wxSOCKET_TIMEDOUT: + return wxT("wxSOCKET_TIMEDOUT"); + break; + case wxSOCKET_MEMERR: + return wxT("wxSOCKET_MEMERR"); + break; + default: + return wxT("Unknown"); + break; + } +} + +//log output types for LogWorker helper function +typedef enum +{ + LOG_MESSAGE, + LOG_ERROR, + LOG_VERBOSE +} logWorker_t; + +//outputs log message with IP and TCP port number prepended +void +LogWorker(const wxIPV4address& pAddr, const wxString& pMessage, logWorker_t pType = LOG_VERBOSE) +{ + wxString msg(wxString::Format(wxT("%s:%d "),pAddr.IPAddress().c_str(),pAddr.Service())); + msg += pMessage; + switch (pType) + { + case LOG_VERBOSE: + wxLogVerbose(msg); + break; + case LOG_MESSAGE: + wxLogMessage(msg); + break; + case LOG_ERROR: + wxLogError(msg); + break; + } +} + +//event sent by workers to server class +//after client is served +const wxEventType wxEVT_WORKER = wxNewEventType(); +#define EVT_WORKER(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_WORKER, -1, -1, (wxObjectEventFunction) (wxEventFunction) (WorkerEventFunction) & func, (wxObject *) NULL ), + +class WorkerEvent : public wxEvent { +public: + WorkerEvent(void* pSender) + { + SetId(-1); + SetEventType(wxEVT_WORKER); + m_sender = pSender; + m_exit = false; + m_workerFailed = false; + } + + virtual wxEvent* Clone() const + { + return new WorkerEvent(*this); + } + + void* m_sender; + bool m_exit; + bool m_workerFailed; +}; + +typedef void (wxEvtHandler::*WorkerEventFunction)(WorkerEvent&); + +class ThreadWorker; +class EventWorker; + +WX_DECLARE_LIST(ThreadWorker, TList); +WX_DECLARE_LIST(EventWorker, EList); + +//main server class contains listening socket +//and list of two type worker classes that serve clients +class Server : public wxApp +{ + DECLARE_EVENT_TABLE(); +public: + Server() : m_maxConnections(-1) {} + ~Server() {} +private: + enum WorkMode + { + MIXED, + THREADS, + EVENTS + }; + + virtual bool OnInit(); + virtual int OnExit(); + + void OnInitCmdLine(wxCmdLineParser& pParser); + bool OnCmdLineParsed(wxCmdLineParser& pParser); + + void OnSocketEvent(wxSocketEvent& pEvent); + void OnWorkerEvent(WorkerEvent& pEvent); + void OnTimerEvent(wxTimerEvent& pEvent); + void DumpStatistics(); + + TList m_threadWorkers; + EList m_eventWorkers; + WorkMode m_workMode; + wxSocketServer* m_listeningSocket; + + // statistics + unsigned m_threadWorkersCreated; + unsigned m_threadWorkersDone; + unsigned m_threadWorkersFailed; + unsigned m_maxThreadWorkers; + + unsigned m_eventWorkersCreated; + unsigned m_eventWorkersDone; + unsigned m_eventWorkersFailed; + unsigned m_maxEventWorkers; + + long int m_maxConnections; + + long m_port; + + wxTimer mTimer; +}; + +DECLARE_APP(Server); + +//thread based worker reads signature and all data first from connected client +//and resends data to client after reading +class ThreadWorker : public wxThread +{ +public: + ThreadWorker(wxSocketBase* pSocket); + virtual ExitCode Entry(); +private: + wxSocketBase* m_socket; + wxIPV4address m_peer; +}; + +//event based worker reads signature and creates buffer for incoming data. +//When part of data arrives this worker resends it as soon as possible. +class EventWorker : public wxEvtHandler +{ + DECLARE_EVENT_TABLE(); +public: + EventWorker(wxSocketBase* pSock); + ~EventWorker(); +private: + wxSocketBase* m_socket; + wxIPV4address m_peer; + + unsigned char m_signature[2]; + char* m_inbuf; + int m_infill; + int m_size; + char* m_outbuf; + int m_outfill; + int m_written; + + void OnSocketEvent(wxSocketEvent& pEvent); + void DoWrite(); + void DoRead(); +}; + +/******************* Implementation ******************/ +IMPLEMENT_APP_CONSOLE(Server) + +#include +WX_DEFINE_LIST(TList); +WX_DEFINE_LIST(EList); + + +void +Server::OnInitCmdLine(wxCmdLineParser& pParser) +{ + wxApp::OnInitCmdLine(pParser); + pParser.AddSwitch(wxT("t"),wxT("threads"),_("Use thread based workers only")); + pParser.AddSwitch(wxT("e"),wxT("events"),_("Use event based workers only")); + pParser.AddOption(wxT("m"),wxT("max"),_("Exit after connections"),wxCMD_LINE_VAL_NUMBER,wxCMD_LINE_PARAM_OPTIONAL); + pParser.AddOption(wxT("p"),wxT("port"),_("listen on given port (default 3000)"),wxCMD_LINE_VAL_NUMBER,wxCMD_LINE_PARAM_OPTIONAL); +} + +void +Server::DumpStatistics() +{ + wxString mode; + switch(m_workMode) + { + case EVENTS: + mode = _("Event based workers"); + break; + case THREADS: + mode = _("Thread based workers"); + break; + case MIXED: + mode = _("Event and thread based workers"); + break; + } + wxLogMessage(wxString::Format(wxT("Server mode: %s"),mode.c_str())); + wxLogMessage(wxString::Format(wxT("\t\t\t\tThreads\tEvents\tTotal"))); + wxLogMessage(wxString::Format(wxT("Workers created:\t\t%d\t%d\t%d"),m_threadWorkersCreated,m_eventWorkersCreated,m_threadWorkersCreated+m_eventWorkersCreated)); + wxLogMessage(wxString::Format(wxT("Max concurrent workers:\t%d\t%d\t%d"),m_maxThreadWorkers,m_maxEventWorkers,m_maxThreadWorkers+m_maxEventWorkers)); + wxLogMessage(wxString::Format(wxT("Workers failed:\t\t%d\t%d\t%d"),m_threadWorkersFailed,m_eventWorkersFailed,m_threadWorkersFailed+m_eventWorkersFailed)); + wxLogMessage(wxString::Format(wxT("Workers done:\t\t%d\t%d\t%d"),m_threadWorkersDone,m_eventWorkersDone,m_threadWorkersDone+m_eventWorkersDone)); + + if ((int)(m_threadWorkersDone+m_eventWorkersDone) == m_maxConnections) + { + wxLogMessage(wxT("%d connection(s) served, exiting"),m_maxConnections); + ExitMainLoop(); + } +} + + +bool +Server::OnCmdLineParsed(wxCmdLineParser& pParser) +{ + if (pParser.Found(_("verbose"))) + { + wxLog::AddTraceMask(wxT("wxSocket")); + wxLog::AddTraceMask(wxT("epolldispatcher")); + wxLog::AddTraceMask(wxT("selectdispatcher")); + wxLog::AddTraceMask(wxT("thread")); + wxLog::AddTraceMask(wxT("events")); + wxLog::AddTraceMask(wxT("timer")); + } + + if (pParser.Found(wxT("m"),&m_maxConnections)) + { + wxLogMessage(wxT("%d connection(s) to exit"),m_maxConnections); + } + + if (pParser.Found(wxT("p"),&m_port)) + { + wxLogMessage(wxT("%d connection(s) to exit"),m_maxConnections); + } + + if (pParser.Found(wxT("t"))) + m_workMode = THREADS; + else if (pParser.Found(wxT("e"))) + m_workMode = EVENTS; + else + m_workMode = MIXED; + + return wxApp::OnCmdLineParsed(pParser); +} + +bool Server::OnInit() +{ + wxLog* logger = new wxLogStderr(); + wxLog::SetActiveTarget(logger); + + m_port = 3000; + + //send interesting things to console + if (!wxApp::OnInit()) + return false; + + //setup listening socket + wxIPV4address la; + la.Service(m_port); + m_listeningSocket = new wxSocketServer(la,wxSOCKET_NOWAIT|wxSOCKET_REUSEADDR); + m_listeningSocket->SetEventHandler(*this); + m_listeningSocket->SetNotify(wxSOCKET_CONNECTION_FLAG); + m_listeningSocket->Notify(true); + if (!m_listeningSocket->Ok()) + { + wxLogError(wxT("Cannot bind listening socket")); + return false; + } + + m_threadWorkersCreated = 0; + m_threadWorkersDone = 0; + m_threadWorkersFailed = 0; + m_maxThreadWorkers = 0; + + m_eventWorkersCreated = 0; + m_eventWorkersDone = 0; + m_eventWorkersFailed = 0; + m_maxEventWorkers = 0; + + wxLogMessage(wxT("Server listening at port %d, waiting for connections"), m_port); + return true; +} + + +int Server::OnExit() +{ + for(TList::compatibility_iterator it = m_threadWorkers.GetFirst(); it ; it = it->GetNext()) { + it->GetData()->Wait(); + delete it->GetData(); + } + + for(EList::compatibility_iterator it = m_eventWorkers.GetFirst(); it ; it->GetNext()) { + delete it->GetData(); + } + + m_threadWorkers.Clear(); + m_eventWorkers.Clear(); + m_listeningSocket->Destroy(); + return 0; +} + +void Server::OnSocketEvent(wxSocketEvent& pEvent) +{ + switch(pEvent.GetSocketEvent()) + { + case wxSOCKET_INPUT: + wxLogError(wxT("Unexpected wxSOCKET_INPUT in wxSocketServer")); + break; + case wxSOCKET_OUTPUT: + wxLogError(wxT("Unexpected wxSOCKET_OUTPUT in wxSocketServer")); + break; + case wxSOCKET_CONNECTION: + { + wxSocketBase* sock = m_listeningSocket->Accept(); + wxIPV4address addr; + if (!sock->GetPeer(addr)) + { + wxLogError(wxT("Server: cannot get peer info")); + } else { + wxLogMessage(wxT("Got connection from %s:%d"),addr.IPAddress().c_str(), addr.Service()); + } + bool createThread; + + if (m_workMode != MIXED) + createThread = m_workMode == THREADS; + else + createThread = (wxDateTime::Now().GetSecond())%2 == 0; + + if (createThread) + { + ThreadWorker* c = new ThreadWorker(sock); + if (c->Create() == wxTHREAD_NO_ERROR) + { + m_threadWorkers.Append(c); + if (m_threadWorkers.GetCount() > m_maxThreadWorkers) + m_maxThreadWorkers++; + m_threadWorkersCreated++; + c->Run(); + } + else + { + wxLogError(wxT("Server: cannot create next thread (current threads: %d"), m_threadWorkers.size()); + }; + } + else + { + EventWorker* w = new EventWorker(sock); + m_eventWorkers.Append(w); + if (m_eventWorkers.GetCount() > m_maxEventWorkers) + m_maxEventWorkers++; + m_eventWorkersCreated++; + } + } + break; + case wxSOCKET_LOST: + wxLogError(wxT("Unexpected wxSOCKET_LOST in wxSocketServer")); + break; + } +} + +void Server::OnWorkerEvent(WorkerEvent& pEvent) +{ + //wxLogMessage(wxT("Got worker event")); + for(TList::compatibility_iterator it = m_threadWorkers.GetFirst(); it ; it = it->GetNext()) + { + if (it->GetData() == pEvent.m_sender) + { + wxLogVerbose(wxT("Deleting thread worker (%d left)"),m_threadWorkers.GetCount()); + it->GetData()->Wait(); + delete it->GetData(); + m_threadWorkers.DeleteNode(it); + if (!pEvent.m_workerFailed) + m_threadWorkersDone++; + else + m_threadWorkersFailed++; + break; + } + } + for(EList::compatibility_iterator it = m_eventWorkers.GetFirst(); it ; it = it->GetNext()) + { + if (it->GetData() == pEvent.m_sender) + { + wxLogVerbose(wxT("Deleting event worker (%d left)"),m_eventWorkers.GetCount()); + delete it->GetData(); + m_eventWorkers.DeleteNode(it); + if (!pEvent.m_workerFailed) + m_eventWorkersDone++; + else + m_eventWorkersFailed++; + break; + } + } + + if (m_eventWorkers.GetCount() == 0 && m_threadWorkers.GetCount() == 0) + { + mTimer.Start(1000,true); + } +} + +void Server::OnTimerEvent(wxTimerEvent&) +{ + DumpStatistics(); +} + + +BEGIN_EVENT_TABLE(Server,wxEvtHandler) + EVT_SOCKET(wxID_ANY,Server::OnSocketEvent) + EVT_WORKER(Server::OnWorkerEvent) + EVT_TIMER(wxID_ANY,Server::OnTimerEvent) +END_EVENT_TABLE() + + +ThreadWorker::ThreadWorker(wxSocketBase* pSocket) : wxThread(wxTHREAD_JOINABLE) +{ + m_socket = pSocket; + //Notify() cannot be called in thread context. We have to detach from main loop + //before switching thread contexts. + m_socket->Notify(false); + m_socket->SetFlags(wxSOCKET_WAITALL|wxSOCKET_BLOCK); + pSocket->GetPeer(m_peer); +} + +wxThread::ExitCode ThreadWorker::Entry() +{ + WorkerEvent e(this); + if (!m_socket->IsConnected()) + { + LogWorker(m_peer,wxT("ThreadWorker: not connected"),LOG_ERROR); + return 0; + } + int to_process = -1; + if (m_socket->IsConnected()) + { + unsigned char signature[2]; + LogWorker(m_peer,wxT("ThreadWorker: reading for data")); + to_process = 2; + do + { + m_socket->Read(&signature,to_process); + if (m_socket->Error()) + { + LogWorker(m_peer,wxT("ThreadWorker: Read error"),LOG_ERROR); + wxGetApp().AddPendingEvent(e); + return 0; + } + to_process -= m_socket->LastCount(); + LogWorker(m_peer,wxString::Format(wxT("to_process: %d"),to_process)); + + } + while (!m_socket->Error() && to_process != 0); + + if (signature[0] == 0) + { + e.m_exit = true; + return 0; + } + + if (signature[0] == 0xCE) + { + LogWorker(m_peer,_("This server does not support test2 from GUI client")); + e.m_workerFailed = true; + e.m_exit = true; + return 0; + } + int size = signature[1] * (signature[0] == 0xBE ? 1 : 1024); + char* buf = new char[size]; + LogWorker(m_peer,wxString::Format(wxT("Message signature: chunks: %d, kilobytes: %d, size: %d (bytes)"),signature[0],signature[1],size)); + + to_process = size; + LogWorker(m_peer,wxString::Format(wxT("ThreadWorker: reading %d bytes of data"),to_process)); + + do + { + m_socket->Read(buf,to_process); + if (m_socket->Error()) + { + LogWorker(m_peer,wxT("ThreadWorker: Read error"),LOG_ERROR); + wxGetApp().AddPendingEvent(e); + return 0; + } + to_process -= m_socket->LastCount(); + LogWorker(m_peer,wxString::Format(wxT("ThreadWorker: %d bytes readed, %d todo"),m_socket->LastCount(),to_process)); + + } + while(!m_socket->Error() && to_process != 0); + + to_process = size; + + do + { + m_socket->Write(buf,to_process); + if (m_socket->Error()) { + LogWorker(m_peer,wxT("ThreadWorker: Write error"),LOG_ERROR); + break; + } + to_process -= m_socket->LastCount(); + LogWorker(m_peer,wxString::Format(wxT("ThreadWorker: %d bytes written, %d todo"),m_socket->LastCount(),to_process)); + } + while(!m_socket->Error() && to_process != 0); + } + + LogWorker(m_peer,wxT("ThreadWorker: done")); + e.m_workerFailed = to_process != 0; + m_socket->Destroy(); + wxGetApp().AddPendingEvent(e); + return 0; +} + +EventWorker::EventWorker(wxSocketBase* pSock) + : m_socket(pSock), + m_inbuf(NULL), + m_infill(0), + m_outbuf(NULL), + m_outfill(0) +{ + m_socket->SetNotify(wxSOCKET_LOST_FLAG|wxSOCKET_INPUT_FLAG|wxSOCKET_OUTPUT_FLAG); + m_socket->Notify(true); + m_socket->SetEventHandler(*this); + m_socket->SetFlags(wxSOCKET_NOWAIT); + m_socket->GetPeer(m_peer); +} + +EventWorker::~EventWorker() { + m_socket->Destroy(); + delete [] m_inbuf; + delete [] m_outbuf; +} + +void +EventWorker::DoRead() +{ + if (m_inbuf == NULL) + { + //read message header + do + { + m_socket->Read(m_signature,2 - m_infill); + if (m_socket->Error()) { + if (m_socket->LastError() != wxSOCKET_WOULDBLOCK) + { + LogWorker(m_peer,wxString::Format(wxT("Read error (%d): %s"),m_socket->LastError(),GetSocketErrorMsg(m_socket->LastError())),LOG_ERROR); + m_socket->Close(); + } + } + else + { + m_infill += m_socket->LastCount(); + if (m_infill == 2) { + unsigned char chunks = m_signature[1]; + unsigned char type = m_signature[0]; + if (type == 0xCE) + { + LogWorker(m_peer,_("This server does not support test2 from GUI client")); + m_written = -1; //wxSOCKET_LOST will interpret this as failure + m_socket->Close(); + } + else if (type == 0xBE || type == 0xDE) + { + m_size = chunks * (type == 0xBE ? 1 : 1024); + m_inbuf = new char[m_size]; + m_outbuf = new char[m_size]; + m_infill = 0; + m_outfill = 0; + m_written = 0; + LogWorker(m_peer,wxString::Format(wxT("Message signature: len: %d, type: %s, size: %d (bytes)"),chunks,type == 0xBE ? wxT("b") : wxT("kB"),m_size)); + break; + } else + { + LogWorker(m_peer,wxString::Format(wxT("Unknown test type %x"),type)); + m_socket->Close(); + } + } + } + } + while(!m_socket->Error() && (2 - m_infill != 0)); + } + + if (m_inbuf == NULL) + return; + //read message data + do { + if (m_size == m_infill) { + m_signature[0] = m_signature[1] = 0x0; + delete [] m_inbuf; + m_inbuf = NULL; + m_infill = 0; + return; + } + m_socket->Read(m_inbuf + m_infill,m_size - m_infill); + if (m_socket->Error()) { + if (m_socket->LastError() != wxSOCKET_WOULDBLOCK) + { + LogWorker( + m_peer, + wxString::Format(wxT("Read error (%d): %s"), + m_socket->LastError(), + GetSocketErrorMsg(m_socket->LastError()) + ), + LOG_ERROR); + + m_socket->Close(); + } + } + else + { + memcpy(m_outbuf+m_outfill,m_inbuf+m_infill,m_socket->LastCount()); + m_infill += m_socket->LastCount(); + m_outfill += m_socket->LastCount(); + DoWrite(); + } + } + while(!m_socket->Error()); +}; + +void EventWorker::OnSocketEvent(wxSocketEvent& pEvent) +{ + switch(pEvent.GetSocketEvent()) + { + case wxSOCKET_INPUT: + DoRead(); + break; + case wxSOCKET_OUTPUT: + if (m_inbuf != NULL) + DoWrite(); + break; + case wxSOCKET_CONNECTION: + LogWorker(m_peer,wxString::Format(wxT("Unexpected wxSOCKET_CONNECTION in EventWorker")),LOG_ERROR); + break; + case wxSOCKET_LOST: + { + LogWorker(m_peer,wxString::Format(wxT("Connection lost"))); + WorkerEvent e(this); + e.m_workerFailed = m_written != m_size; + wxGetApp().AddPendingEvent(e); + } + break; + } +} + +void EventWorker::DoWrite() { + do { + if (m_written == m_size) + { + delete [] m_outbuf; + m_outbuf = NULL; + m_outfill = 0; + LogWorker(m_peer,wxString::Format(wxT("All data written"))); + return; + } + if (m_outfill - m_written == 0) + { + return; + } + m_socket->Write(m_outbuf + m_written,m_outfill - m_written); + if (m_socket->Error()) + { + if (m_socket->LastError() != wxSOCKET_WOULDBLOCK) + { + LogWorker(m_peer, + wxString::Format(wxT("Write error (%d): %s"), + m_socket->LastError(), + GetSocketErrorMsg(m_socket->LastError()) + ) + ,LOG_ERROR + ); + m_socket->Close(); + } + else + { + LogWorker(m_peer,wxString::Format(wxT("Write would block, waiting for OUTPUT event"))); + } + } + else + { + memmove(m_outbuf,m_outbuf+m_socket->LastCount(),m_outfill-m_socket->LastCount()); + m_written += m_socket->LastCount(); + } + LogWorker(m_peer,wxString::Format(wxT("Written %d of %d bytes, todo %d"),m_socket->LastCount(),m_size,m_size - m_written)); + } + while (!m_socket->Error()); +} + +BEGIN_EVENT_TABLE(EventWorker,wxEvtHandler) + EVT_SOCKET(wxID_ANY,EventWorker::OnSocketEvent) +END_EVENT_TABLE() diff --git a/samples/sockets/client.cpp b/samples/sockets/client.cpp index 30f13995bc..ce196d8cd6 100644 --- a/samples/sockets/client.cpp +++ b/samples/sockets/client.cpp @@ -38,9 +38,7 @@ // -------------------------------------------------------------------------- // the application icon -#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__) -# include "mondrian.xpm" -#endif +#include "mondrian.xpm" // -------------------------------------------------------------------------- // classes diff --git a/samples/sockets/makefile.bcc b/samples/sockets/makefile.bcc index 2bf3acb08a..66dbd657f5 100644 --- a/samples/sockets/makefile.bcc +++ b/samples/sockets/makefile.bcc @@ -29,7 +29,7 @@ LIBDIRNAME = .\..\..\lib\$(COMPILER_PREFIX)_$(LIBTYPE_SUFFIX)$(CFG) SETUPHDIR = \ $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG) CLIENT_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \ - $(__OPTIMIZEFLAG) $(__THREADSFLAG_0) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \ + $(__OPTIMIZEFLAG) $(__THREADSFLAG_2) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \ $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) $(__MSLU_DEFINE_p) \ $(__GFXCTX_DEFINE_p) -I$(SETUPHDIR) -I.\..\..\include -I. $(__DLLFLAG_p) \ @@ -37,13 +37,29 @@ CLIENT_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \ CLIENT_OBJECTS = \ $(OBJS)\client_client.obj SERVER_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \ - $(__OPTIMIZEFLAG) $(__THREADSFLAG_0) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \ + $(__OPTIMIZEFLAG) $(__THREADSFLAG_2) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \ $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) $(__MSLU_DEFINE_p) \ $(__GFXCTX_DEFINE_p) -I$(SETUPHDIR) -I.\..\..\include -I. $(__DLLFLAG_p) \ -I.\..\..\samples -DNOPCH $(CPPFLAGS) $(CXXFLAGS) SERVER_OBJECTS = \ $(OBJS)\server_server.obj +BASECLIENT_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \ + $(__OPTIMIZEFLAG) $(__THREADSFLAG_2) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \ + $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ + $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) $(__MSLU_DEFINE_p) \ + $(__GFXCTX_DEFINE_p) -I$(SETUPHDIR) -I.\..\..\include -I. $(__DLLFLAG_p) \ + -DwxUSE_GUI=0 $(CPPFLAGS) $(CXXFLAGS) +BASECLIENT_OBJECTS = \ + $(OBJS)\baseclient_baseclient.obj +BASESERVER_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \ + $(__OPTIMIZEFLAG) $(__THREADSFLAG_2) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \ + $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ + $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) $(__MSLU_DEFINE_p) \ + $(__GFXCTX_DEFINE_p) -I$(SETUPHDIR) -I.\..\..\include -I. $(__DLLFLAG_p) \ + -DwxUSE_GUI=0 $(CPPFLAGS) $(CXXFLAGS) +BASESERVER_OBJECTS = \ + $(OBJS)\baseserver_baseserver.obj ### Conditionally set variables: ### @@ -80,6 +96,58 @@ EXTRALIBS_FOR_BASE = !if "$(MONOLITHIC)" == "1" EXTRALIBS_FOR_BASE = !endif +!if "$(USE_GUI)" == "1" +__client___depname = $(OBJS)\client.exe +!endif +!if "$(USE_GUI)" == "1" +__server___depname = $(OBJS)\server.exe +!endif +!if "$(WXUNIV)" == "1" +__WXUNIV_DEFINE_p_0 = -d__WXUNIVERSAL__ +!endif +!if "$(BUILD)" == "debug" && "$(DEBUG_FLAG)" == "default" +__DEBUG_DEFINE_p_0 = -d__WXDEBUG__ +!endif +!if "$(DEBUG_FLAG)" == "1" +__DEBUG_DEFINE_p_0 = -d__WXDEBUG__ +!endif +!if "$(USE_EXCEPTIONS)" == "0" +__EXCEPTIONS_DEFINE_p_0 = -dwxNO_EXCEPTIONS +!endif +!if "$(USE_RTTI)" == "0" +__RTTI_DEFINE_p_0 = -dwxNO_RTTI +!endif +!if "$(USE_THREADS)" == "0" +__THREAD_DEFINE_p_0 = -dwxNO_THREADS +!endif +!if "$(UNICODE)" == "0" +__UNICODE_DEFINE_p_0 = -dwxUSE_UNICODE=0 +!endif +!if "$(UNICODE)" == "1" +__UNICODE_DEFINE_p_0 = -d_UNICODE +!endif +!if "$(MSLU)" == "1" +__MSLU_DEFINE_p_0 = -dwxUSE_UNICODE_MSLU=1 +!endif +!if "$(USE_GDIPLUS)" == "1" +__GFXCTX_DEFINE_p_0 = -dwxUSE_GRAPHICS_CONTEXT=1 +!endif +!if "$(SHARED)" == "1" +__DLLFLAG_p_0 = -dWXUSINGDLL +!endif +!if "$(MONOLITHIC)" == "0" +__WXLIB_CORE_p = \ + wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core.lib +!endif +!if "$(USE_GUI)" == "1" +__LIB_TIFF_p = wxtiff$(WXDEBUGFLAG).lib +!endif +!if "$(USE_GUI)" == "1" +__LIB_JPEG_p = wxjpeg$(WXDEBUGFLAG).lib +!endif +!if "$(USE_GUI)" == "1" +__LIB_PNG_p = wxpng$(WXDEBUGFLAG).lib +!endif !if "$(BUILD)" == "debug" __OPTIMIZEFLAG = -Od !endif @@ -93,10 +161,10 @@ __THREADSFLAG = __THREADSFLAG = mt !endif !if "$(USE_THREADS)" == "0" -__THREADSFLAG_0 = +__THREADSFLAG_2 = !endif !if "$(USE_THREADS)" == "1" -__THREADSFLAG_0 = -tWM +__THREADSFLAG_2 = -tWM !endif !if "$(RUNTIME_LIBS)" == "dynamic" __RUNTIME_LIBS = -tWR @@ -105,81 +173,44 @@ __RUNTIME_LIBS = -tWR __RUNTIME_LIBS = !endif !if "$(RUNTIME_LIBS)" == "dynamic" -__RUNTIME_LIBS_0 = i +__RUNTIME_LIBS_2 = i !endif !if "$(RUNTIME_LIBS)" == "static" -__RUNTIME_LIBS_0 = +__RUNTIME_LIBS_2 = !endif !if "$(WXUNIV)" == "1" __WXUNIV_DEFINE_p = -D__WXUNIVERSAL__ !endif -!if "$(WXUNIV)" == "1" -__WXUNIV_DEFINE_p_0 = -d__WXUNIVERSAL__ -!endif !if "$(BUILD)" == "debug" && "$(DEBUG_FLAG)" == "default" __DEBUG_DEFINE_p = -D__WXDEBUG__ !endif !if "$(DEBUG_FLAG)" == "1" __DEBUG_DEFINE_p = -D__WXDEBUG__ !endif -!if "$(BUILD)" == "debug" && "$(DEBUG_FLAG)" == "default" -__DEBUG_DEFINE_p_0 = -d__WXDEBUG__ -!endif -!if "$(DEBUG_FLAG)" == "1" -__DEBUG_DEFINE_p_0 = -d__WXDEBUG__ -!endif !if "$(USE_EXCEPTIONS)" == "0" __EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS !endif -!if "$(USE_EXCEPTIONS)" == "0" -__EXCEPTIONS_DEFINE_p_0 = -dwxNO_EXCEPTIONS -!endif !if "$(USE_RTTI)" == "0" __RTTI_DEFINE_p = -DwxNO_RTTI !endif -!if "$(USE_RTTI)" == "0" -__RTTI_DEFINE_p_0 = -dwxNO_RTTI -!endif !if "$(USE_THREADS)" == "0" __THREAD_DEFINE_p = -DwxNO_THREADS !endif -!if "$(USE_THREADS)" == "0" -__THREAD_DEFINE_p_0 = -dwxNO_THREADS -!endif !if "$(UNICODE)" == "0" __UNICODE_DEFINE_p = -DwxUSE_UNICODE=0 !endif !if "$(UNICODE)" == "1" __UNICODE_DEFINE_p = -D_UNICODE !endif -!if "$(UNICODE)" == "0" -__UNICODE_DEFINE_p_0 = -dwxUSE_UNICODE=0 -!endif -!if "$(UNICODE)" == "1" -__UNICODE_DEFINE_p_0 = -d_UNICODE -!endif !if "$(MSLU)" == "1" __MSLU_DEFINE_p = -DwxUSE_UNICODE_MSLU=1 !endif -!if "$(MSLU)" == "1" -__MSLU_DEFINE_p_0 = -dwxUSE_UNICODE_MSLU=1 -!endif !if "$(USE_GDIPLUS)" == "1" __GFXCTX_DEFINE_p = -DwxUSE_GRAPHICS_CONTEXT=1 !endif -!if "$(USE_GDIPLUS)" == "1" -__GFXCTX_DEFINE_p_0 = -dwxUSE_GRAPHICS_CONTEXT=1 -!endif !if "$(SHARED)" == "1" __DLLFLAG_p = -DWXUSINGDLL !endif -!if "$(SHARED)" == "1" -__DLLFLAG_p_0 = -dWXUSINGDLL -!endif -!if "$(MONOLITHIC)" == "0" -__WXLIB_CORE_p = \ - wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core.lib -!endif !if "$(MONOLITHIC)" == "0" __WXLIB_NET_p = \ wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net.lib @@ -192,15 +223,6 @@ __WXLIB_BASE_p = \ __WXLIB_MONO_p = \ wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib !endif -!if "$(USE_GUI)" == "1" -__LIB_TIFF_p = wxtiff$(WXDEBUGFLAG).lib -!endif -!if "$(USE_GUI)" == "1" -__LIB_JPEG_p = wxjpeg$(WXDEBUGFLAG).lib -!endif -!if "$(USE_GUI)" == "1" -__LIB_PNG_p = wxpng$(WXDEBUGFLAG).lib -!endif !if "$(MSLU)" == "1" __UNICOWS_LIB_p = unicows.lib !endif @@ -227,7 +249,7 @@ $(OBJS): ### Targets: ### -all: $(OBJS)\client.exe $(OBJS)\server.exe +all: $(__client___depname) $(__server___depname) $(OBJS)\baseclient.exe $(OBJS)\baseserver.exe clean: -if exist $(OBJS)\*.obj del $(OBJS)\*.obj @@ -245,15 +267,41 @@ clean: -if exist $(OBJS)\server.ild del $(OBJS)\server.ild -if exist $(OBJS)\server.ilf del $(OBJS)\server.ilf -if exist $(OBJS)\server.ils del $(OBJS)\server.ils + -if exist $(OBJS)\baseclient.exe del $(OBJS)\baseclient.exe + -if exist $(OBJS)\baseclient.tds del $(OBJS)\baseclient.tds + -if exist $(OBJS)\baseclient.ilc del $(OBJS)\baseclient.ilc + -if exist $(OBJS)\baseclient.ild del $(OBJS)\baseclient.ild + -if exist $(OBJS)\baseclient.ilf del $(OBJS)\baseclient.ilf + -if exist $(OBJS)\baseclient.ils del $(OBJS)\baseclient.ils + -if exist $(OBJS)\baseserver.exe del $(OBJS)\baseserver.exe + -if exist $(OBJS)\baseserver.tds del $(OBJS)\baseserver.tds + -if exist $(OBJS)\baseserver.ilc del $(OBJS)\baseserver.ilc + -if exist $(OBJS)\baseserver.ild del $(OBJS)\baseserver.ild + -if exist $(OBJS)\baseserver.ilf del $(OBJS)\baseserver.ilf + -if exist $(OBJS)\baseserver.ils del $(OBJS)\baseserver.ils +!if "$(USE_GUI)" == "1" $(OBJS)\client.exe: $(CLIENT_OBJECTS) $(OBJS)\client_client.res ilink32 -Tpe -q $(LDFLAGS) -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) -aa @&&| - c0w32.obj $(CLIENT_OBJECTS),$@,, $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32$(__THREADSFLAG)$(__RUNTIME_LIBS_0).lib,, $(OBJS)\client_client.res + c0w32.obj $(CLIENT_OBJECTS),$@,, $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32$(__THREADSFLAG)$(__RUNTIME_LIBS_2).lib,, $(OBJS)\client_client.res | +!endif +!if "$(USE_GUI)" == "1" $(OBJS)\server.exe: $(SERVER_OBJECTS) $(OBJS)\server_server.res ilink32 -Tpe -q $(LDFLAGS) -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) -aa @&&| - c0w32.obj $(SERVER_OBJECTS),$@,, $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32$(__THREADSFLAG)$(__RUNTIME_LIBS_0).lib,, $(OBJS)\server_server.res + c0w32.obj $(SERVER_OBJECTS),$@,, $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32$(__THREADSFLAG)$(__RUNTIME_LIBS_2).lib,, $(OBJS)\server_server.res +| +!endif + +$(OBJS)\baseclient.exe: $(BASECLIENT_OBJECTS) + ilink32 -Tpe -q $(LDFLAGS) -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) -ap @&&| + c0x32.obj $(BASECLIENT_OBJECTS),$@,, $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32$(__THREADSFLAG)$(__RUNTIME_LIBS_2).lib,, +| + +$(OBJS)\baseserver.exe: $(BASESERVER_OBJECTS) + ilink32 -Tpe -q $(LDFLAGS) -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUGINFO) -L$(LIBDIRNAME) -ap @&&| + c0x32.obj $(BASESERVER_OBJECTS),$@,, $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) ole2w32.lib oleacc.lib import32.lib cw32$(__THREADSFLAG)$(__RUNTIME_LIBS_2).lib,, | $(OBJS)\client_client.obj: .\client.cpp @@ -268,3 +316,9 @@ $(OBJS)\server_server.obj: .\server.cpp $(OBJS)\server_server.res: .\server.rc brcc32 -32 -r -fo$@ -i$(BCCDIR)\include -d__WXMSW__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) $(__UNICODE_DEFINE_p_0) $(__MSLU_DEFINE_p_0) $(__GFXCTX_DEFINE_p_0) -i$(SETUPHDIR) -i.\..\..\include -i. $(__DLLFLAG_p_0) -i.\..\..\samples -dNOPCH $** +$(OBJS)\baseclient_baseclient.obj: .\baseclient.cpp + $(CXX) -q -c -P -o$@ $(BASECLIENT_CXXFLAGS) $** + +$(OBJS)\baseserver_baseserver.obj: .\baseserver.cpp + $(CXX) -q -c -P -o$@ $(BASESERVER_CXXFLAGS) $** + diff --git a/samples/sockets/makefile.gcc b/samples/sockets/makefile.gcc index fc8765748d..1c537d96fe 100644 --- a/samples/sockets/makefile.gcc +++ b/samples/sockets/makefile.gcc @@ -40,6 +40,24 @@ SERVER_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) $(GCCFLAGS) SERVER_OBJECTS = \ $(OBJS)\server_server.o \ $(OBJS)\server_server_rc.o +BASECLIENT_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) \ + $(GCCFLAGS) -DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) \ + $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ + $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) $(__MSLU_DEFINE_p) \ + $(__GFXCTX_DEFINE_p) -I$(SETUPHDIR) -I.\..\..\include -W -Wall -I. \ + $(__DLLFLAG_p) -DwxUSE_GUI=0 $(__RTTIFLAG) $(__EXCEPTIONSFLAG) \ + -Wno-ctor-dtor-privacy $(CPPFLAGS) $(CXXFLAGS) +BASECLIENT_OBJECTS = \ + $(OBJS)\baseclient_baseclient.o +BASESERVER_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) \ + $(GCCFLAGS) -DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) \ + $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ + $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) $(__MSLU_DEFINE_p) \ + $(__GFXCTX_DEFINE_p) -I$(SETUPHDIR) -I.\..\..\include -W -Wall -I. \ + $(__DLLFLAG_p) -DwxUSE_GUI=0 $(__RTTIFLAG) $(__EXCEPTIONSFLAG) \ + -Wno-ctor-dtor-privacy $(CPPFLAGS) $(CXXFLAGS) +BASESERVER_OBJECTS = \ + $(OBJS)\baseserver_baseserver.o ### Conditionally set variables: ### @@ -81,6 +99,60 @@ endif ifeq ($(MONOLITHIC),1) EXTRALIBS_FOR_BASE = endif +ifeq ($(USE_GUI),1) +__client___depname = $(OBJS)\client.exe +endif +ifeq ($(USE_GUI),1) +__server___depname = $(OBJS)\server.exe +endif +ifeq ($(WXUNIV),1) +__WXUNIV_DEFINE_p_0 = --define __WXUNIVERSAL__ +endif +ifeq ($(BUILD),debug) +ifeq ($(DEBUG_FLAG),default) +__DEBUG_DEFINE_p_0 = --define __WXDEBUG__ +endif +endif +ifeq ($(DEBUG_FLAG),1) +__DEBUG_DEFINE_p_0 = --define __WXDEBUG__ +endif +ifeq ($(USE_EXCEPTIONS),0) +__EXCEPTIONS_DEFINE_p_0 = --define wxNO_EXCEPTIONS +endif +ifeq ($(USE_RTTI),0) +__RTTI_DEFINE_p_0 = --define wxNO_RTTI +endif +ifeq ($(USE_THREADS),0) +__THREAD_DEFINE_p_0 = --define wxNO_THREADS +endif +ifeq ($(UNICODE),0) +__UNICODE_DEFINE_p_0 = --define wxUSE_UNICODE=0 +endif +ifeq ($(UNICODE),1) +__UNICODE_DEFINE_p_0 = --define _UNICODE +endif +ifeq ($(MSLU),1) +__MSLU_DEFINE_p_0 = --define wxUSE_UNICODE_MSLU=1 +endif +ifeq ($(USE_GDIPLUS),1) +__GFXCTX_DEFINE_p_0 = --define wxUSE_GRAPHICS_CONTEXT=1 +endif +ifeq ($(SHARED),1) +__DLLFLAG_p_0 = --define WXUSINGDLL +endif +ifeq ($(MONOLITHIC),0) +__WXLIB_CORE_p = \ + -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core +endif +ifeq ($(USE_GUI),1) +__LIB_TIFF_p = -lwxtiff$(WXDEBUGFLAG) +endif +ifeq ($(USE_GUI),1) +__LIB_JPEG_p = -lwxjpeg$(WXDEBUGFLAG) +endif +ifeq ($(USE_GUI),1) +__LIB_PNG_p = -lwxpng$(WXDEBUGFLAG) +endif ifeq ($(BUILD),debug) __OPTIMIZEFLAG = -O0 endif @@ -102,9 +174,6 @@ endif ifeq ($(WXUNIV),1) __WXUNIV_DEFINE_p = -D__WXUNIVERSAL__ endif -ifeq ($(WXUNIV),1) -__WXUNIV_DEFINE_p_0 = --define __WXUNIVERSAL__ -endif ifeq ($(BUILD),debug) ifeq ($(DEBUG_FLAG),default) __DEBUG_DEFINE_p = -D__WXDEBUG__ @@ -113,66 +182,30 @@ endif ifeq ($(DEBUG_FLAG),1) __DEBUG_DEFINE_p = -D__WXDEBUG__ endif -ifeq ($(BUILD),debug) -ifeq ($(DEBUG_FLAG),default) -__DEBUG_DEFINE_p_0 = --define __WXDEBUG__ -endif -endif -ifeq ($(DEBUG_FLAG),1) -__DEBUG_DEFINE_p_0 = --define __WXDEBUG__ -endif ifeq ($(USE_EXCEPTIONS),0) __EXCEPTIONS_DEFINE_p = -DwxNO_EXCEPTIONS endif -ifeq ($(USE_EXCEPTIONS),0) -__EXCEPTIONS_DEFINE_p_0 = --define wxNO_EXCEPTIONS -endif ifeq ($(USE_RTTI),0) __RTTI_DEFINE_p = -DwxNO_RTTI endif -ifeq ($(USE_RTTI),0) -__RTTI_DEFINE_p_0 = --define wxNO_RTTI -endif ifeq ($(USE_THREADS),0) __THREAD_DEFINE_p = -DwxNO_THREADS endif -ifeq ($(USE_THREADS),0) -__THREAD_DEFINE_p_0 = --define wxNO_THREADS -endif ifeq ($(UNICODE),0) __UNICODE_DEFINE_p = -DwxUSE_UNICODE=0 endif ifeq ($(UNICODE),1) __UNICODE_DEFINE_p = -D_UNICODE endif -ifeq ($(UNICODE),0) -__UNICODE_DEFINE_p_0 = --define wxUSE_UNICODE=0 -endif -ifeq ($(UNICODE),1) -__UNICODE_DEFINE_p_0 = --define _UNICODE -endif ifeq ($(MSLU),1) __MSLU_DEFINE_p = -DwxUSE_UNICODE_MSLU=1 endif -ifeq ($(MSLU),1) -__MSLU_DEFINE_p_0 = --define wxUSE_UNICODE_MSLU=1 -endif ifeq ($(USE_GDIPLUS),1) __GFXCTX_DEFINE_p = -DwxUSE_GRAPHICS_CONTEXT=1 endif -ifeq ($(USE_GDIPLUS),1) -__GFXCTX_DEFINE_p_0 = --define wxUSE_GRAPHICS_CONTEXT=1 -endif ifeq ($(SHARED),1) __DLLFLAG_p = -DWXUSINGDLL endif -ifeq ($(SHARED),1) -__DLLFLAG_p_0 = --define WXUSINGDLL -endif -ifeq ($(MONOLITHIC),0) -__WXLIB_CORE_p = \ - -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core -endif ifeq ($(MONOLITHIC),0) __WXLIB_NET_p = \ -lwxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net @@ -185,15 +218,6 @@ ifeq ($(MONOLITHIC),1) __WXLIB_MONO_p = \ -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR) endif -ifeq ($(USE_GUI),1) -__LIB_TIFF_p = -lwxtiff$(WXDEBUGFLAG) -endif -ifeq ($(USE_GUI),1) -__LIB_JPEG_p = -lwxjpeg$(WXDEBUGFLAG) -endif -ifeq ($(USE_GUI),1) -__LIB_PNG_p = -lwxpng$(WXDEBUGFLAG) -endif ifeq ($(MSLU),1) __UNICOWS_LIB_p = -lunicows endif @@ -230,19 +254,31 @@ $(OBJS): ### Targets: ### -all: $(OBJS)\client.exe $(OBJS)\server.exe +all: $(__client___depname) $(__server___depname) $(OBJS)\baseclient.exe $(OBJS)\baseserver.exe clean: -if exist $(OBJS)\*.o del $(OBJS)\*.o -if exist $(OBJS)\*.d del $(OBJS)\*.d -if exist $(OBJS)\client.exe del $(OBJS)\client.exe -if exist $(OBJS)\server.exe del $(OBJS)\server.exe + -if exist $(OBJS)\baseclient.exe del $(OBJS)\baseclient.exe + -if exist $(OBJS)\baseserver.exe del $(OBJS)\baseserver.exe +ifeq ($(USE_GUI),1) $(OBJS)\client.exe: $(CLIENT_OBJECTS) $(OBJS)\client_client_rc.o $(CXX) -o $@ $(CLIENT_OBJECTS) $(LDFLAGS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 +endif +ifeq ($(USE_GUI),1) $(OBJS)\server.exe: $(SERVER_OBJECTS) $(OBJS)\server_server_rc.o $(CXX) -o $@ $(SERVER_OBJECTS) $(LDFLAGS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 +endif + +$(OBJS)\baseclient.exe: $(BASECLIENT_OBJECTS) + $(CXX) -o $@ $(BASECLIENT_OBJECTS) $(LDFLAGS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 + +$(OBJS)\baseserver.exe: $(BASESERVER_OBJECTS) + $(CXX) -o $@ $(BASESERVER_OBJECTS) $(LDFLAGS) $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) -lwxzlib$(WXDEBUGFLAG) -lwxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lwsock32 $(OBJS)\client_client.o: ./client.cpp $(CXX) -c -o $@ $(CLIENT_CXXFLAGS) $(CPPDEPS) $< @@ -256,6 +292,12 @@ $(OBJS)\server_server.o: ./server.cpp $(OBJS)\server_server_rc.o: ./server.rc windres --use-temp-file -i$< -o$@ --define __WXMSW__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) $(__UNICODE_DEFINE_p_0) $(__MSLU_DEFINE_p_0) $(__GFXCTX_DEFINE_p_0) --include-dir $(SETUPHDIR) --include-dir ./../../include --include-dir . $(__DLLFLAG_p_0) --include-dir ./../../samples --define NOPCH +$(OBJS)\baseclient_baseclient.o: ./baseclient.cpp + $(CXX) -c -o $@ $(BASECLIENT_CXXFLAGS) $(CPPDEPS) $< + +$(OBJS)\baseserver_baseserver.o: ./baseserver.cpp + $(CXX) -c -o $@ $(BASESERVER_CXXFLAGS) $(CPPDEPS) $< + .PHONY: all clean diff --git a/samples/sockets/makefile.unx b/samples/sockets/makefile.unx index a372525193..3c09e39474 100644 --- a/samples/sockets/makefile.unx +++ b/samples/sockets/makefile.unx @@ -62,6 +62,14 @@ SERVER_CXXFLAGS = -I. `$(WX_CONFIG) --cxxflags $(WX_CONFIG_FLAGS)` $(CPPFLAGS) \ $(CXXFLAGS) SERVER_OBJECTS = \ server_server.o +BASECLIENT_CXXFLAGS = -I. `$(WX_CONFIG) --cxxflags $(WX_CONFIG_FLAGS)` \ + $(CPPFLAGS) $(CXXFLAGS) +BASECLIENT_OBJECTS = \ + baseclient_baseclient.o +BASESERVER_CXXFLAGS = -I. `$(WX_CONFIG) --cxxflags $(WX_CONFIG_FLAGS)` \ + $(CPPFLAGS) $(CXXFLAGS) +BASESERVER_OBJECTS = \ + baseserver_baseserver.o ### Conditionally set variables: ### @@ -87,7 +95,7 @@ endif ### Targets: ### -all: test_for_selected_wxbuild client server +all: test_for_selected_wxbuild client server baseclient baseserver install: all @@ -98,6 +106,8 @@ clean: rm -f ./*.d rm -f client rm -f server + rm -f baseclient + rm -f baseserver test_for_selected_wxbuild: @$(WX_CONFIG) $(WX_CONFIG_FLAGS) @@ -108,12 +118,24 @@ client: $(CLIENT_OBJECTS) server: $(SERVER_OBJECTS) $(CXX) -o $@ $(SERVER_OBJECTS) $(LDFLAGS) `$(WX_CONFIG) $(WX_CONFIG_FLAGS) --libs core,net,base` +baseclient: $(BASECLIENT_OBJECTS) + $(CXX) -o $@ $(BASECLIENT_OBJECTS) $(LDFLAGS) `$(WX_CONFIG) $(WX_CONFIG_FLAGS) --libs net,base` + +baseserver: $(BASESERVER_OBJECTS) + $(CXX) -o $@ $(BASESERVER_OBJECTS) $(LDFLAGS) `$(WX_CONFIG) $(WX_CONFIG_FLAGS) --libs net,base` + client_client.o: ./client.cpp $(CXX) -c -o $@ $(CLIENT_CXXFLAGS) $(CPPDEPS) $< server_server.o: ./server.cpp $(CXX) -c -o $@ $(SERVER_CXXFLAGS) $(CPPDEPS) $< +baseclient_baseclient.o: ./baseclient.cpp + $(CXX) -c -o $@ $(BASECLIENT_CXXFLAGS) $(CPPDEPS) $< + +baseserver_baseserver.o: ./baseserver.cpp + $(CXX) -c -o $@ $(BASESERVER_CXXFLAGS) $(CPPDEPS) $< + .PHONY: all install uninstall clean diff --git a/samples/sockets/makefile.vc b/samples/sockets/makefile.vc index 869f1d2fb7..d61ef9781f 100644 --- a/samples/sockets/makefile.vc +++ b/samples/sockets/makefile.vc @@ -42,6 +42,26 @@ SERVER_CXXFLAGS = /M$(__RUNTIME_LIBS_22)$(__DEBUGRUNTIME) /DWIN32 \ SERVER_OBJECTS = \ $(OBJS)\server_server.obj \ $(OBJS)\server_server.res +BASECLIENT_CXXFLAGS = /M$(__RUNTIME_LIBS_36)$(__DEBUGRUNTIME) /DWIN32 \ + $(__DEBUGINFO) /Fd$(OBJS)\baseclient.pdb $(____DEBUGRUNTIME) \ + $(__OPTIMIZEFLAG) $(__NO_VC_CRTDBG_p) /D__WXMSW__ $(__WXUNIV_DEFINE_p) \ + $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ + $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) $(__MSLU_DEFINE_p) \ + $(__GFXCTX_DEFINE_p) /I$(SETUPHDIR) /I.\..\..\include /W4 /I. $(__DLLFLAG_p) \ + /D_CONSOLE /DwxUSE_GUI=0 $(__RTTIFLAG) $(__EXCEPTIONSFLAG) $(CPPFLAGS) \ + $(CXXFLAGS) +BASECLIENT_OBJECTS = \ + $(OBJS)\baseclient_baseclient.obj +BASESERVER_CXXFLAGS = /M$(__RUNTIME_LIBS_50)$(__DEBUGRUNTIME) /DWIN32 \ + $(__DEBUGINFO) /Fd$(OBJS)\baseserver.pdb $(____DEBUGRUNTIME) \ + $(__OPTIMIZEFLAG) $(__NO_VC_CRTDBG_p) /D__WXMSW__ $(__WXUNIV_DEFINE_p) \ + $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ + $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) $(__MSLU_DEFINE_p) \ + $(__GFXCTX_DEFINE_p) /I$(SETUPHDIR) /I.\..\..\include /W4 /I. $(__DLLFLAG_p) \ + /D_CONSOLE /DwxUSE_GUI=0 $(__RTTIFLAG) $(__EXCEPTIONSFLAG) $(CPPFLAGS) \ + $(CXXFLAGS) +BASESERVER_OBJECTS = \ + $(OBJS)\baseserver_baseserver.obj ### Conditionally set variables: ### @@ -102,18 +122,100 @@ EXTRALIBS_FOR_BASE = !if "$(MONOLITHIC)" == "1" EXTRALIBS_FOR_BASE = !endif +!if "$(USE_GUI)" == "1" +__client___depname = $(OBJS)\client.exe +!endif !if "$(RUNTIME_LIBS)" == "dynamic" __RUNTIME_LIBS_8 = D !endif !if "$(RUNTIME_LIBS)" == "static" __RUNTIME_LIBS_8 = $(__THREADSFLAG) !endif +!if "$(USE_GUI)" == "1" +__server___depname = $(OBJS)\server.exe +!endif !if "$(RUNTIME_LIBS)" == "dynamic" __RUNTIME_LIBS_22 = D !endif !if "$(RUNTIME_LIBS)" == "static" __RUNTIME_LIBS_22 = $(__THREADSFLAG) !endif +!if "$(RUNTIME_LIBS)" == "dynamic" +__RUNTIME_LIBS_36 = D +!endif +!if "$(RUNTIME_LIBS)" == "static" +__RUNTIME_LIBS_36 = $(__THREADSFLAG) +!endif +!if "$(RUNTIME_LIBS)" == "dynamic" +__RUNTIME_LIBS_50 = D +!endif +!if "$(RUNTIME_LIBS)" == "static" +__RUNTIME_LIBS_50 = $(__THREADSFLAG) +!endif +!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default" +____DEBUGRUNTIME_0 = /d _DEBUG +!endif +!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default" +____DEBUGRUNTIME_0 = +!endif +!if "$(DEBUG_RUNTIME_LIBS)" == "0" +____DEBUGRUNTIME_0 = +!endif +!if "$(DEBUG_RUNTIME_LIBS)" == "1" +____DEBUGRUNTIME_0 = /d _DEBUG +!endif +!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "0" +__NO_VC_CRTDBG_p_0 = /d __NO_VC_CRTDBG__ +!endif +!if "$(BUILD)" == "release" && "$(DEBUG_FLAG)" == "1" +__NO_VC_CRTDBG_p_0 = /d __NO_VC_CRTDBG__ +!endif +!if "$(WXUNIV)" == "1" +__WXUNIV_DEFINE_p_0 = /d __WXUNIVERSAL__ +!endif +!if "$(BUILD)" == "debug" && "$(DEBUG_FLAG)" == "default" +__DEBUG_DEFINE_p_0 = /d __WXDEBUG__ +!endif +!if "$(DEBUG_FLAG)" == "1" +__DEBUG_DEFINE_p_0 = /d __WXDEBUG__ +!endif +!if "$(USE_EXCEPTIONS)" == "0" +__EXCEPTIONS_DEFINE_p_0 = /d wxNO_EXCEPTIONS +!endif +!if "$(USE_RTTI)" == "0" +__RTTI_DEFINE_p_0 = /d wxNO_RTTI +!endif +!if "$(USE_THREADS)" == "0" +__THREAD_DEFINE_p_0 = /d wxNO_THREADS +!endif +!if "$(UNICODE)" == "0" +__UNICODE_DEFINE_p_0 = /d wxUSE_UNICODE=0 +!endif +!if "$(UNICODE)" == "1" +__UNICODE_DEFINE_p_0 = /d _UNICODE +!endif +!if "$(MSLU)" == "1" +__MSLU_DEFINE_p_0 = /d wxUSE_UNICODE_MSLU=1 +!endif +!if "$(USE_GDIPLUS)" == "1" +__GFXCTX_DEFINE_p_0 = /d wxUSE_GRAPHICS_CONTEXT=1 +!endif +!if "$(SHARED)" == "1" +__DLLFLAG_p_0 = /d WXUSINGDLL +!endif +!if "$(MONOLITHIC)" == "0" +__WXLIB_CORE_p = \ + wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core.lib +!endif +!if "$(USE_GUI)" == "1" +__LIB_TIFF_p = wxtiff$(WXDEBUGFLAG).lib +!endif +!if "$(USE_GUI)" == "1" +__LIB_JPEG_p = wxjpeg$(WXDEBUGFLAG).lib +!endif +!if "$(USE_GUI)" == "1" +__LIB_PNG_p = wxpng$(WXDEBUGFLAG).lib +!endif !if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default" __DEBUGINFO = /Zi !endif @@ -127,16 +229,16 @@ __DEBUGINFO = __DEBUGINFO = /Zi !endif !if "$(BUILD)" == "debug" && "$(DEBUG_INFO)" == "default" -__DEBUGINFO_1 = /DEBUG +__DEBUGINFO_3 = /DEBUG !endif !if "$(BUILD)" == "release" && "$(DEBUG_INFO)" == "default" -__DEBUGINFO_1 = +__DEBUGINFO_3 = !endif !if "$(DEBUG_INFO)" == "0" -__DEBUGINFO_1 = +__DEBUGINFO_3 = !endif !if "$(DEBUG_INFO)" == "1" -__DEBUGINFO_1 = /DEBUG +__DEBUGINFO_3 = /DEBUG !endif !if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default" ____DEBUGRUNTIME = /D_DEBUG @@ -151,18 +253,6 @@ ____DEBUGRUNTIME = ____DEBUGRUNTIME = /D_DEBUG !endif !if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default" -____DEBUGRUNTIME_0 = /d _DEBUG -!endif -!if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default" -____DEBUGRUNTIME_0 = -!endif -!if "$(DEBUG_RUNTIME_LIBS)" == "0" -____DEBUGRUNTIME_0 = -!endif -!if "$(DEBUG_RUNTIME_LIBS)" == "1" -____DEBUGRUNTIME_0 = /d _DEBUG -!endif -!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default" __DEBUGRUNTIME = d !endif !if "$(BUILD)" == "release" && "$(DEBUG_RUNTIME_LIBS)" == "default" @@ -204,82 +294,39 @@ __NO_VC_CRTDBG_p = /D__NO_VC_CRTDBG__ !if "$(BUILD)" == "release" && "$(DEBUG_FLAG)" == "1" __NO_VC_CRTDBG_p = /D__NO_VC_CRTDBG__ !endif -!if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "0" -__NO_VC_CRTDBG_p_0 = /d __NO_VC_CRTDBG__ -!endif -!if "$(BUILD)" == "release" && "$(DEBUG_FLAG)" == "1" -__NO_VC_CRTDBG_p_0 = /d __NO_VC_CRTDBG__ -!endif !if "$(WXUNIV)" == "1" __WXUNIV_DEFINE_p = /D__WXUNIVERSAL__ !endif -!if "$(WXUNIV)" == "1" -__WXUNIV_DEFINE_p_0 = /d __WXUNIVERSAL__ -!endif !if "$(BUILD)" == "debug" && "$(DEBUG_FLAG)" == "default" __DEBUG_DEFINE_p = /D__WXDEBUG__ !endif !if "$(DEBUG_FLAG)" == "1" __DEBUG_DEFINE_p = /D__WXDEBUG__ !endif -!if "$(BUILD)" == "debug" && "$(DEBUG_FLAG)" == "default" -__DEBUG_DEFINE_p_0 = /d __WXDEBUG__ -!endif -!if "$(DEBUG_FLAG)" == "1" -__DEBUG_DEFINE_p_0 = /d __WXDEBUG__ -!endif !if "$(USE_EXCEPTIONS)" == "0" __EXCEPTIONS_DEFINE_p = /DwxNO_EXCEPTIONS !endif -!if "$(USE_EXCEPTIONS)" == "0" -__EXCEPTIONS_DEFINE_p_0 = /d wxNO_EXCEPTIONS -!endif !if "$(USE_RTTI)" == "0" __RTTI_DEFINE_p = /DwxNO_RTTI !endif -!if "$(USE_RTTI)" == "0" -__RTTI_DEFINE_p_0 = /d wxNO_RTTI -!endif !if "$(USE_THREADS)" == "0" __THREAD_DEFINE_p = /DwxNO_THREADS !endif -!if "$(USE_THREADS)" == "0" -__THREAD_DEFINE_p_0 = /d wxNO_THREADS -!endif !if "$(UNICODE)" == "0" __UNICODE_DEFINE_p = /DwxUSE_UNICODE=0 !endif !if "$(UNICODE)" == "1" __UNICODE_DEFINE_p = /D_UNICODE !endif -!if "$(UNICODE)" == "0" -__UNICODE_DEFINE_p_0 = /d wxUSE_UNICODE=0 -!endif -!if "$(UNICODE)" == "1" -__UNICODE_DEFINE_p_0 = /d _UNICODE -!endif !if "$(MSLU)" == "1" __MSLU_DEFINE_p = /DwxUSE_UNICODE_MSLU=1 !endif -!if "$(MSLU)" == "1" -__MSLU_DEFINE_p_0 = /d wxUSE_UNICODE_MSLU=1 -!endif !if "$(USE_GDIPLUS)" == "1" __GFXCTX_DEFINE_p = /DwxUSE_GRAPHICS_CONTEXT=1 !endif -!if "$(USE_GDIPLUS)" == "1" -__GFXCTX_DEFINE_p_0 = /d wxUSE_GRAPHICS_CONTEXT=1 -!endif !if "$(SHARED)" == "1" __DLLFLAG_p = /DWXUSINGDLL !endif -!if "$(SHARED)" == "1" -__DLLFLAG_p_0 = /d WXUSINGDLL -!endif -!if "$(MONOLITHIC)" == "0" -__WXLIB_CORE_p = \ - wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core.lib -!endif !if "$(MONOLITHIC)" == "0" __WXLIB_NET_p = \ wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net.lib @@ -292,15 +339,6 @@ __WXLIB_BASE_p = \ __WXLIB_MONO_p = \ wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib !endif -!if "$(USE_GUI)" == "1" -__LIB_TIFF_p = wxtiff$(WXDEBUGFLAG).lib -!endif -!if "$(USE_GUI)" == "1" -__LIB_JPEG_p = wxjpeg$(WXDEBUGFLAG).lib -!endif -!if "$(USE_GUI)" == "1" -__LIB_PNG_p = wxpng$(WXDEBUGFLAG).lib -!endif !if "$(MSLU)" == "1" __UNICOWS_LIB_p = unicows.lib !endif @@ -315,7 +353,7 @@ $(OBJS): ### Targets: ### -all: $(OBJS)\client.exe $(OBJS)\server.exe +all: $(__client___depname) $(__server___depname) $(OBJS)\baseclient.exe $(OBJS)\baseserver.exe clean: -if exist $(OBJS)\*.obj del $(OBJS)\*.obj @@ -327,16 +365,36 @@ clean: -if exist $(OBJS)\server.exe del $(OBJS)\server.exe -if exist $(OBJS)\server.ilk del $(OBJS)\server.ilk -if exist $(OBJS)\server.pdb del $(OBJS)\server.pdb + -if exist $(OBJS)\baseclient.exe del $(OBJS)\baseclient.exe + -if exist $(OBJS)\baseclient.ilk del $(OBJS)\baseclient.ilk + -if exist $(OBJS)\baseclient.pdb del $(OBJS)\baseclient.pdb + -if exist $(OBJS)\baseserver.exe del $(OBJS)\baseserver.exe + -if exist $(OBJS)\baseserver.ilk del $(OBJS)\baseserver.ilk + -if exist $(OBJS)\baseserver.pdb del $(OBJS)\baseserver.pdb +!if "$(USE_GUI)" == "1" $(OBJS)\client.exe: $(CLIENT_OBJECTS) $(OBJS)\client_client.res - link /NOLOGO /OUT:$@ $(LDFLAGS) $(__DEBUGINFO_1) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:WINDOWS @<< + link /NOLOGO /OUT:$@ $(LDFLAGS) $(__DEBUGINFO_3) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:WINDOWS @<< $(CLIENT_OBJECTS) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib << +!endif +!if "$(USE_GUI)" == "1" $(OBJS)\server.exe: $(SERVER_OBJECTS) $(OBJS)\server_server.res - link /NOLOGO /OUT:$@ $(LDFLAGS) $(__DEBUGINFO_1) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:WINDOWS @<< + link /NOLOGO /OUT:$@ $(LDFLAGS) $(__DEBUGINFO_3) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:WINDOWS @<< $(SERVER_OBJECTS) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib << +!endif + +$(OBJS)\baseclient.exe: $(BASECLIENT_OBJECTS) + link /NOLOGO /OUT:$@ $(LDFLAGS) $(__DEBUGINFO_3) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:CONSOLE @<< + $(BASECLIENT_OBJECTS) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib +<< + +$(OBJS)\baseserver.exe: $(BASESERVER_OBJECTS) + link /NOLOGO /OUT:$@ $(LDFLAGS) $(__DEBUGINFO_3) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) /SUBSYSTEM:CONSOLE @<< + $(BASESERVER_OBJECTS) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__UNICOWS_LIB_p) $(__GDIPLUS_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib +<< $(OBJS)\client_client.obj: .\client.cpp $(CXX) /c /nologo /TP /Fo$@ $(CLIENT_CXXFLAGS) $** @@ -350,3 +408,9 @@ $(OBJS)\server_server.obj: .\server.cpp $(OBJS)\server_server.res: .\server.rc rc /fo$@ /d WIN32 $(____DEBUGRUNTIME_0) $(__NO_VC_CRTDBG_p_0) /d __WXMSW__ $(__WXUNIV_DEFINE_p_0) $(__DEBUG_DEFINE_p_0) $(__EXCEPTIONS_DEFINE_p_0) $(__RTTI_DEFINE_p_0) $(__THREAD_DEFINE_p_0) $(__UNICODE_DEFINE_p_0) $(__MSLU_DEFINE_p_0) $(__GFXCTX_DEFINE_p_0) /i $(SETUPHDIR) /i .\..\..\include /i . $(__DLLFLAG_p_0) /d _WINDOWS /i .\..\..\samples /d NOPCH $** +$(OBJS)\baseclient_baseclient.obj: .\baseclient.cpp + $(CXX) /c /nologo /TP /Fo$@ $(BASECLIENT_CXXFLAGS) $** + +$(OBJS)\baseserver_baseserver.obj: .\baseserver.cpp + $(CXX) /c /nologo /TP /Fo$@ $(BASESERVER_CXXFLAGS) $** + diff --git a/samples/sockets/makefile.wat b/samples/sockets/makefile.wat index d5e022f540..df2fa6180c 100644 --- a/samples/sockets/makefile.wat +++ b/samples/sockets/makefile.wat @@ -69,6 +69,31 @@ EXTRALIBS_FOR_BASE = !ifeq MONOLITHIC 1 EXTRALIBS_FOR_BASE = !endif +__client___depname = +!ifeq USE_GUI 1 +__client___depname = $(OBJS)\client.exe +!endif +__server___depname = +!ifeq USE_GUI 1 +__server___depname = $(OBJS)\server.exe +!endif +__WXLIB_CORE_p = +!ifeq MONOLITHIC 0 +__WXLIB_CORE_p = & + wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core.lib +!endif +__LIB_TIFF_p = +!ifeq USE_GUI 1 +__LIB_TIFF_p = wxtiff$(WXDEBUGFLAG).lib +!endif +__LIB_JPEG_p = +!ifeq USE_GUI 1 +__LIB_JPEG_p = wxjpeg$(WXDEBUGFLAG).lib +!endif +__LIB_PNG_p = +!ifeq USE_GUI 1 +__LIB_PNG_p = wxpng$(WXDEBUGFLAG).lib +!endif __DEBUGINFO = !ifeq BUILD debug !ifeq DEBUG_INFO default @@ -86,22 +111,22 @@ __DEBUGINFO = -d0 !ifeq DEBUG_INFO 1 __DEBUGINFO = -d2 !endif -__DEBUGINFO_1 = +__DEBUGINFO_3 = !ifeq BUILD debug !ifeq DEBUG_INFO default -__DEBUGINFO_1 = debug all +__DEBUGINFO_3 = debug all !endif !endif !ifeq BUILD release !ifeq DEBUG_INFO default -__DEBUGINFO_1 = +__DEBUGINFO_3 = !endif !endif !ifeq DEBUG_INFO 0 -__DEBUGINFO_1 = +__DEBUGINFO_3 = !endif !ifeq DEBUG_INFO 1 -__DEBUGINFO_1 = debug all +__DEBUGINFO_3 = debug all !endif __OPTIMIZEFLAG = !ifeq BUILD debug @@ -138,42 +163,6 @@ __EXCEPTIONSFLAG = !ifeq USE_EXCEPTIONS 1 __EXCEPTIONSFLAG = -xs !endif -__WXLIB_CORE_p = -!ifeq MONOLITHIC 0 -__WXLIB_CORE_p = & - wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core.lib -!endif -__WXLIB_NET_p = -!ifeq MONOLITHIC 0 -__WXLIB_NET_p = & - wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net.lib -!endif -__WXLIB_BASE_p = -!ifeq MONOLITHIC 0 -__WXLIB_BASE_p = & - wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib -!endif -__WXLIB_MONO_p = -!ifeq MONOLITHIC 1 -__WXLIB_MONO_p = & - wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib -!endif -__LIB_TIFF_p = -!ifeq USE_GUI 1 -__LIB_TIFF_p = wxtiff$(WXDEBUGFLAG).lib -!endif -__LIB_JPEG_p = -!ifeq USE_GUI 1 -__LIB_JPEG_p = wxjpeg$(WXDEBUGFLAG).lib -!endif -__LIB_PNG_p = -!ifeq USE_GUI 1 -__LIB_PNG_p = wxpng$(WXDEBUGFLAG).lib -!endif -__GDIPLUS_LIB_p = -!ifeq USE_GDIPLUS 1 -__GDIPLUS_LIB_p = gdiplus.lib -!endif __WXUNIV_DEFINE_p = !ifeq WXUNIV 1 __WXUNIV_DEFINE_p = -d__WXUNIVERSAL__ @@ -214,6 +203,25 @@ __DLLFLAG_p = !ifeq SHARED 1 __DLLFLAG_p = -dWXUSINGDLL !endif +__WXLIB_NET_p = +!ifeq MONOLITHIC 0 +__WXLIB_NET_p = & + wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_net.lib +!endif +__WXLIB_BASE_p = +!ifeq MONOLITHIC 0 +__WXLIB_BASE_p = & + wxbase$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib +!endif +__WXLIB_MONO_p = +!ifeq MONOLITHIC 1 +__WXLIB_MONO_p = & + wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib +!endif +__GDIPLUS_LIB_p = +!ifeq USE_GDIPLUS 1 +__GDIPLUS_LIB_p = gdiplus.lib +!endif ### Variables: ### @@ -242,6 +250,22 @@ SERVER_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) & $(CXXFLAGS) SERVER_OBJECTS = & $(OBJS)\server_server.obj +BASECLIENT_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) & + $(__RUNTIME_LIBS) -d__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) & + $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) & + $(__UNICODE_DEFINE_p) $(__GFXCTX_DEFINE_p) -i=$(SETUPHDIR) & + -i=.\..\..\include -wx -wcd=549 -wcd=656 -wcd=657 -wcd=667 -i=. $(__DLLFLAG_p) & + -dwxUSE_GUI=0 $(__RTTIFLAG) $(__EXCEPTIONSFLAG) $(CPPFLAGS) $(CXXFLAGS) +BASECLIENT_OBJECTS = & + $(OBJS)\baseclient_baseclient.obj +BASESERVER_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) & + $(__RUNTIME_LIBS) -d__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) & + $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) & + $(__UNICODE_DEFINE_p) $(__GFXCTX_DEFINE_p) -i=$(SETUPHDIR) & + -i=.\..\..\include -wx -wcd=549 -wcd=656 -wcd=657 -wcd=667 -i=. $(__DLLFLAG_p) & + -dwxUSE_GUI=0 $(__RTTIFLAG) $(__EXCEPTIONSFLAG) $(CPPFLAGS) $(CXXFLAGS) +BASESERVER_OBJECTS = & + $(OBJS)\baseserver_baseserver.obj all : $(OBJS) @@ -250,7 +274,7 @@ $(OBJS) : ### Targets: ### -all : .SYMBOLIC $(OBJS)\client.exe $(OBJS)\server.exe +all : .SYMBOLIC $(__client___depname) $(__server___depname) $(OBJS)\baseclient.exe $(OBJS)\baseserver.exe clean : .SYMBOLIC -if exist $(OBJS)\*.obj del $(OBJS)\*.obj @@ -260,30 +284,60 @@ clean : .SYMBOLIC -if exist $(OBJS)\*.pch del $(OBJS)\*.pch -if exist $(OBJS)\client.exe del $(OBJS)\client.exe -if exist $(OBJS)\server.exe del $(OBJS)\server.exe + -if exist $(OBJS)\baseclient.exe del $(OBJS)\baseclient.exe + -if exist $(OBJS)\baseserver.exe del $(OBJS)\baseserver.exe +!ifeq USE_GUI 1 $(OBJS)\client.exe : $(CLIENT_OBJECTS) $(OBJS)\client_client.res @%create $(OBJS)\client.lbc @%append $(OBJS)\client.lbc option quiet @%append $(OBJS)\client.lbc name $^@ @%append $(OBJS)\client.lbc option caseexact - @%append $(OBJS)\client.lbc $(LDFLAGS) $(__DEBUGINFO_1) libpath $(LIBDIRNAME) system nt_win ref '_WinMain@16' + @%append $(OBJS)\client.lbc $(LDFLAGS) $(__DEBUGINFO_3) libpath $(LIBDIRNAME) system nt_win ref '_WinMain@16' @for %i in ($(CLIENT_OBJECTS)) do @%append $(OBJS)\client.lbc file %i @for %i in ( $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__GDIPLUS_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib) do @%append $(OBJS)\client.lbc library %i @%append $(OBJS)\client.lbc option resource=$(OBJS)\client_client.res @for %i in () do @%append $(OBJS)\client.lbc option stack=%i wlink @$(OBJS)\client.lbc +!endif +!ifeq USE_GUI 1 $(OBJS)\server.exe : $(SERVER_OBJECTS) $(OBJS)\server_server.res @%create $(OBJS)\server.lbc @%append $(OBJS)\server.lbc option quiet @%append $(OBJS)\server.lbc name $^@ @%append $(OBJS)\server.lbc option caseexact - @%append $(OBJS)\server.lbc $(LDFLAGS) $(__DEBUGINFO_1) libpath $(LIBDIRNAME) system nt_win ref '_WinMain@16' + @%append $(OBJS)\server.lbc $(LDFLAGS) $(__DEBUGINFO_3) libpath $(LIBDIRNAME) system nt_win ref '_WinMain@16' @for %i in ($(SERVER_OBJECTS)) do @%append $(OBJS)\server.lbc file %i @for %i in ( $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__GDIPLUS_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib) do @%append $(OBJS)\server.lbc library %i @%append $(OBJS)\server.lbc option resource=$(OBJS)\server_server.res @for %i in () do @%append $(OBJS)\server.lbc option stack=%i wlink @$(OBJS)\server.lbc +!endif + +$(OBJS)\baseclient.exe : $(BASECLIENT_OBJECTS) + @%create $(OBJS)\baseclient.lbc + @%append $(OBJS)\baseclient.lbc option quiet + @%append $(OBJS)\baseclient.lbc name $^@ + @%append $(OBJS)\baseclient.lbc option caseexact + @%append $(OBJS)\baseclient.lbc $(LDFLAGS) $(__DEBUGINFO_3) libpath $(LIBDIRNAME) system nt ref 'main_' + @for %i in ($(BASECLIENT_OBJECTS)) do @%append $(OBJS)\baseclient.lbc file %i + @for %i in ( $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__GDIPLUS_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib) do @%append $(OBJS)\baseclient.lbc library %i + @%append $(OBJS)\baseclient.lbc + @for %i in () do @%append $(OBJS)\baseclient.lbc option stack=%i + wlink @$(OBJS)\baseclient.lbc + +$(OBJS)\baseserver.exe : $(BASESERVER_OBJECTS) + @%create $(OBJS)\baseserver.lbc + @%append $(OBJS)\baseserver.lbc option quiet + @%append $(OBJS)\baseserver.lbc name $^@ + @%append $(OBJS)\baseserver.lbc option caseexact + @%append $(OBJS)\baseserver.lbc $(LDFLAGS) $(__DEBUGINFO_3) libpath $(LIBDIRNAME) system nt ref 'main_' + @for %i in ($(BASESERVER_OBJECTS)) do @%append $(OBJS)\baseserver.lbc file %i + @for %i in ( $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) wxzlib$(WXDEBUGFLAG).lib wxregex$(WXUNICODEFLAG)$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__GDIPLUS_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib) do @%append $(OBJS)\baseserver.lbc library %i + @%append $(OBJS)\baseserver.lbc + @for %i in () do @%append $(OBJS)\baseserver.lbc option stack=%i + wlink @$(OBJS)\baseserver.lbc $(OBJS)\client_client.obj : .AUTODEPEND .\client.cpp $(CXX) -bt=nt -zq -fo=$^@ $(CLIENT_CXXFLAGS) $< @@ -297,3 +351,9 @@ $(OBJS)\server_server.obj : .AUTODEPEND .\server.cpp $(OBJS)\server_server.res : .AUTODEPEND .\server.rc wrc -q -ad -bt=nt -r -fo=$^@ -d__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) $(__THREAD_DEFINE_p) $(__UNICODE_DEFINE_p) $(__GFXCTX_DEFINE_p) -i=$(SETUPHDIR) -i=.\..\..\include -i=. $(__DLLFLAG_p) -i=.\..\..\samples -dNOPCH $< +$(OBJS)\baseclient_baseclient.obj : .AUTODEPEND .\baseclient.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(BASECLIENT_CXXFLAGS) $< + +$(OBJS)\baseserver_baseserver.obj : .AUTODEPEND .\baseserver.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(BASESERVER_CXXFLAGS) $< + diff --git a/samples/sockets/server.cpp b/samples/sockets/server.cpp index 452e3dcc8a..cd8fe59d5b 100644 --- a/samples/sockets/server.cpp +++ b/samples/sockets/server.cpp @@ -36,9 +36,7 @@ // -------------------------------------------------------------------------- // the application icon -#if defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__) -# include "mondrian.xpm" -#endif +#include "mondrian.xpm" // -------------------------------------------------------------------------- // classes diff --git a/samples/sockets/sockets.bkl b/samples/sockets/sockets.bkl index e6d17d058a..0e9b60e45e 100644 --- a/samples/sockets/sockets.bkl +++ b/samples/sockets/sockets.bkl @@ -3,7 +3,15 @@ - + + + 1 + + + USE_GUI=='1' + + + client.cpp core net @@ -11,7 +19,7 @@ client.rc - + server.cpp core net @@ -19,4 +27,18 @@ server.rc + + baseclient.cpp + net + base + + + + baseserver.cpp + net + base + + diff --git a/samples/sockets/sockets_baseclient.dsp b/samples/sockets/sockets_baseclient.dsp new file mode 100644 index 0000000000..126667d1a9 --- /dev/null +++ b/samples/sockets/sockets_baseclient.dsp @@ -0,0 +1,243 @@ +# Microsoft Developer Studio Project File - Name="sockets_baseclient" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=baseclient - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "sockets_baseclient.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "sockets_baseclient.mak" CFG="baseclient - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "baseclient - Win32 DLL Universal Release" (based on "Win32 (x86) Console Application") +!MESSAGE "baseclient - Win32 DLL Universal Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "baseclient - Win32 DLL Release" (based on "Win32 (x86) Console Application") +!MESSAGE "baseclient - Win32 DLL Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "baseclient - Win32 Universal Release" (based on "Win32 (x86) Console Application") +!MESSAGE "baseclient - Win32 Universal Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "baseclient - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "baseclient - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "baseclient - Win32 DLL Universal Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "vc_mswunivudll" +# PROP BASE Intermediate_Dir "vc_mswunivudll\baseclient" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "vc_mswunivudll" +# PROP Intermediate_Dir "vc_mswunivudll\baseclient" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MD /Fdvc_mswunivudll\baseclient.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_dll\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MD /Fdvc_mswunivudll\baseclient.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_dll\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswunivu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswunivu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivudll\baseclient.exe" /libpath:".\..\..\lib\vc_dll" /subsystem:console +# ADD LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivudll\baseclient.exe" /libpath:".\..\..\lib\vc_dll" /subsystem:console + +!ELSEIF "$(CFG)" == "baseclient - Win32 DLL Universal Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "vc_mswunivuddll" +# PROP BASE Intermediate_Dir "vc_mswunivuddll\baseclient" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "vc_mswunivuddll" +# PROP Intermediate_Dir "vc_mswunivuddll\baseclient" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswunivuddll\baseclient.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_dll\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswunivuddll\baseclient.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_dll\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswunivud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswunivud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivuddll\baseclient.exe" /debug /libpath:".\..\..\lib\vc_dll" /subsystem:console +# ADD LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivuddll\baseclient.exe" /debug /libpath:".\..\..\lib\vc_dll" /subsystem:console + +!ELSEIF "$(CFG)" == "baseclient - Win32 DLL Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "vc_mswudll" +# PROP BASE Intermediate_Dir "vc_mswudll\baseclient" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "vc_mswudll" +# PROP Intermediate_Dir "vc_mswudll\baseclient" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MD /Fdvc_mswudll\baseclient.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_dll\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MD /Fdvc_mswudll\baseclient.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_dll\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswudll\baseclient.exe" /libpath:".\..\..\lib\vc_dll" /subsystem:console +# ADD LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswudll\baseclient.exe" /libpath:".\..\..\lib\vc_dll" /subsystem:console + +!ELSEIF "$(CFG)" == "baseclient - Win32 DLL Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "vc_mswuddll" +# PROP BASE Intermediate_Dir "vc_mswuddll\baseclient" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "vc_mswuddll" +# PROP Intermediate_Dir "vc_mswuddll\baseclient" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswuddll\baseclient.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_dll\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswuddll\baseclient.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_dll\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswuddll\baseclient.exe" /debug /libpath:".\..\..\lib\vc_dll" /subsystem:console +# ADD LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswuddll\baseclient.exe" /debug /libpath:".\..\..\lib\vc_dll" /subsystem:console + +!ELSEIF "$(CFG)" == "baseclient - Win32 Universal Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "vc_mswunivu" +# PROP BASE Intermediate_Dir "vc_mswunivu\baseclient" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "vc_mswunivu" +# PROP Intermediate_Dir "vc_mswunivu\baseclient" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MD /Fdvc_mswunivu\baseclient.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_lib\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MD /Fdvc_mswunivu\baseclient.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_lib\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswunivu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswunivu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivu\baseclient.exe" /libpath:".\..\..\lib\vc_lib" /subsystem:console +# ADD LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivu\baseclient.exe" /libpath:".\..\..\lib\vc_lib" /subsystem:console + +!ELSEIF "$(CFG)" == "baseclient - Win32 Universal Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "vc_mswunivud" +# PROP BASE Intermediate_Dir "vc_mswunivud\baseclient" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "vc_mswunivud" +# PROP Intermediate_Dir "vc_mswunivud\baseclient" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswunivud\baseclient.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_lib\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswunivud\baseclient.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_lib\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswunivud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswunivud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivud\baseclient.exe" /debug /libpath:".\..\..\lib\vc_lib" /subsystem:console +# ADD LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivud\baseclient.exe" /debug /libpath:".\..\..\lib\vc_lib" /subsystem:console + +!ELSEIF "$(CFG)" == "baseclient - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "vc_mswu" +# PROP BASE Intermediate_Dir "vc_mswu\baseclient" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "vc_mswu" +# PROP Intermediate_Dir "vc_mswu\baseclient" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MD /Fdvc_mswu\baseclient.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_lib\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MD /Fdvc_mswu\baseclient.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_lib\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswu\baseclient.exe" /libpath:".\..\..\lib\vc_lib" /subsystem:console +# ADD LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswu\baseclient.exe" /libpath:".\..\..\lib\vc_lib" /subsystem:console + +!ELSEIF "$(CFG)" == "baseclient - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "vc_mswud" +# PROP BASE Intermediate_Dir "vc_mswud\baseclient" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "vc_mswud" +# PROP Intermediate_Dir "vc_mswud\baseclient" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswud\baseclient.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_lib\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswud\baseclient.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_lib\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswud\baseclient.exe" /debug /libpath:".\..\..\lib\vc_lib" /subsystem:console +# ADD LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswud\baseclient.exe" /debug /libpath:".\..\..\lib\vc_lib" /subsystem:console + +!ENDIF + +# Begin Target + +# Name "baseclient - Win32 DLL Universal Release" +# Name "baseclient - Win32 DLL Universal Debug" +# Name "baseclient - Win32 DLL Release" +# Name "baseclient - Win32 DLL Debug" +# Name "baseclient - Win32 Universal Release" +# Name "baseclient - Win32 Universal Debug" +# Name "baseclient - Win32 Release" +# Name "baseclient - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\baseclient.cpp +# End Source File +# End Group +# End Target +# End Project + diff --git a/samples/sockets/sockets_baseserver.dsp b/samples/sockets/sockets_baseserver.dsp new file mode 100644 index 0000000000..3275f56c87 --- /dev/null +++ b/samples/sockets/sockets_baseserver.dsp @@ -0,0 +1,243 @@ +# Microsoft Developer Studio Project File - Name="sockets_baseserver" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=baseserver - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "sockets_baseserver.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "sockets_baseserver.mak" CFG="baseserver - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "baseserver - Win32 DLL Universal Release" (based on "Win32 (x86) Console Application") +!MESSAGE "baseserver - Win32 DLL Universal Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "baseserver - Win32 DLL Release" (based on "Win32 (x86) Console Application") +!MESSAGE "baseserver - Win32 DLL Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "baseserver - Win32 Universal Release" (based on "Win32 (x86) Console Application") +!MESSAGE "baseserver - Win32 Universal Debug" (based on "Win32 (x86) Console Application") +!MESSAGE "baseserver - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "baseserver - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "baseserver - Win32 DLL Universal Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "vc_mswunivudll" +# PROP BASE Intermediate_Dir "vc_mswunivudll\baseserver" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "vc_mswunivudll" +# PROP Intermediate_Dir "vc_mswunivudll\baseserver" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MD /Fdvc_mswunivudll\baseserver.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_dll\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MD /Fdvc_mswunivudll\baseserver.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_dll\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswunivu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswunivu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivudll\baseserver.exe" /libpath:".\..\..\lib\vc_dll" /subsystem:console +# ADD LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivudll\baseserver.exe" /libpath:".\..\..\lib\vc_dll" /subsystem:console + +!ELSEIF "$(CFG)" == "baseserver - Win32 DLL Universal Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "vc_mswunivuddll" +# PROP BASE Intermediate_Dir "vc_mswunivuddll\baseserver" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "vc_mswunivuddll" +# PROP Intermediate_Dir "vc_mswunivuddll\baseserver" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswunivuddll\baseserver.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_dll\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswunivuddll\baseserver.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_dll\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswunivud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswunivud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivuddll\baseserver.exe" /debug /libpath:".\..\..\lib\vc_dll" /subsystem:console +# ADD LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivuddll\baseserver.exe" /debug /libpath:".\..\..\lib\vc_dll" /subsystem:console + +!ELSEIF "$(CFG)" == "baseserver - Win32 DLL Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "vc_mswudll" +# PROP BASE Intermediate_Dir "vc_mswudll\baseserver" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "vc_mswudll" +# PROP Intermediate_Dir "vc_mswudll\baseserver" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MD /Fdvc_mswudll\baseserver.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_dll\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MD /Fdvc_mswudll\baseserver.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_dll\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswu" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswudll\baseserver.exe" /libpath:".\..\..\lib\vc_dll" /subsystem:console +# ADD LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswudll\baseserver.exe" /libpath:".\..\..\lib\vc_dll" /subsystem:console + +!ELSEIF "$(CFG)" == "baseserver - Win32 DLL Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "vc_mswuddll" +# PROP BASE Intermediate_Dir "vc_mswuddll\baseserver" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "vc_mswuddll" +# PROP Intermediate_Dir "vc_mswuddll\baseserver" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswuddll\baseserver.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_dll\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswuddll\baseserver.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_dll\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "WXUSINGDLL" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_dll\mswud" /i ".\..\..\include" /i "." /d "WXUSINGDLL" /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswuddll\baseserver.exe" /debug /libpath:".\..\..\lib\vc_dll" /subsystem:console +# ADD LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswuddll\baseserver.exe" /debug /libpath:".\..\..\lib\vc_dll" /subsystem:console + +!ELSEIF "$(CFG)" == "baseserver - Win32 Universal Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "vc_mswunivu" +# PROP BASE Intermediate_Dir "vc_mswunivu\baseserver" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "vc_mswunivu" +# PROP Intermediate_Dir "vc_mswunivu\baseserver" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MD /Fdvc_mswunivu\baseserver.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_lib\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MD /Fdvc_mswunivu\baseserver.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_lib\mswunivu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswunivu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswunivu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivu\baseserver.exe" /libpath:".\..\..\lib\vc_lib" /subsystem:console +# ADD LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivu\baseserver.exe" /libpath:".\..\..\lib\vc_lib" /subsystem:console + +!ELSEIF "$(CFG)" == "baseserver - Win32 Universal Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "vc_mswunivud" +# PROP BASE Intermediate_Dir "vc_mswunivud\baseserver" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "vc_mswunivud" +# PROP Intermediate_Dir "vc_mswunivud\baseserver" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswunivud\baseserver.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_lib\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswunivud\baseserver.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_lib\mswunivud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXUNIVERSAL__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswunivud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXUNIVERSAL__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswunivud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivud\baseserver.exe" /debug /libpath:".\..\..\lib\vc_lib" /subsystem:console +# ADD LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswunivud\baseserver.exe" /debug /libpath:".\..\..\lib\vc_lib" /subsystem:console + +!ELSEIF "$(CFG)" == "baseserver - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "vc_mswu" +# PROP BASE Intermediate_Dir "vc_mswu\baseserver" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "vc_mswu" +# PROP Intermediate_Dir "vc_mswu\baseserver" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MD /Fdvc_mswu\baseserver.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_lib\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MD /Fdvc_mswu\baseserver.pdb /O2 /GR /EHsc /I ".\..\..\lib\vc_lib\mswu" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "__WXMSW__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "__WXMSW__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswu" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswu\baseserver.exe" /libpath:".\..\..\lib\vc_lib" /subsystem:console +# ADD LINK32 wxbase29u_net.lib wxbase29u.lib wxzlib.lib wxregexu.lib wxexpat.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswu\baseserver.exe" /libpath:".\..\..\lib\vc_lib" /subsystem:console + +!ELSEIF "$(CFG)" == "baseserver - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "vc_mswud" +# PROP BASE Intermediate_Dir "vc_mswud\baseserver" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "vc_mswud" +# PROP Intermediate_Dir "vc_mswud\baseserver" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswud\baseserver.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_lib\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD CPP /nologo /FD /MDd /Zi /Gm /GZ /Fdvc_mswud\baseserver.pdb /Od /GR /EHsc /I ".\..\..\lib\vc_lib\mswud" /I ".\..\..\include" /W4 /I "." /D "WIN32" /D "_DEBUG" /D "__WXMSW__" /D "__WXDEBUG__" /D "_UNICODE" /D "_CONSOLE" /D wxUSE_GUI=0 /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +# ADD RSC /l 0x409 /d "_DEBUG" /d "__WXMSW__" /d "__WXDEBUG__" /d "_UNICODE" /i ".\..\..\lib\vc_lib\mswud" /i ".\..\..\include" /i "." /d "_CONSOLE" /d wxUSE_GUI=0 +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswud\baseserver.exe" /debug /libpath:".\..\..\lib\vc_lib" /subsystem:console +# ADD LINK32 wxbase29ud_net.lib wxbase29ud.lib wxzlibd.lib wxregexud.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib /nologo /machine:i386 /out:"vc_mswud\baseserver.exe" /debug /libpath:".\..\..\lib\vc_lib" /subsystem:console + +!ENDIF + +# Begin Target + +# Name "baseserver - Win32 DLL Universal Release" +# Name "baseserver - Win32 DLL Universal Debug" +# Name "baseserver - Win32 DLL Release" +# Name "baseserver - Win32 DLL Debug" +# Name "baseserver - Win32 Universal Release" +# Name "baseserver - Win32 Universal Debug" +# Name "baseserver - Win32 Release" +# Name "baseserver - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "" +# Begin Source File + +SOURCE=.\baseserver.cpp +# End Source File +# End Group +# End Target +# End Project + diff --git a/src/common/appbase.cpp b/src/common/appbase.cpp index 962a5c52cf..d2b8a4c3f3 100644 --- a/src/common/appbase.cpp +++ b/src/common/appbase.cpp @@ -645,13 +645,6 @@ void wxConsoleAppTraitsBase::RemoveFromPendingDelete(wxObject * WXUNUSED(object) // nothing to do } -#if wxUSE_SOCKETS -GSocketGUIFunctionsTable* wxConsoleAppTraitsBase::GetSocketGUIFunctionsTable() -{ - return NULL; -} -#endif - // ---------------------------------------------------------------------------- // wxAppTraits // ---------------------------------------------------------------------------- diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index fc3bdeff62..3be7882932 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -545,28 +545,3 @@ void wxGUIAppTraitsBase::RemoveFromPendingDelete(wxObject *object) wxPendingDelete.DeleteObject(object); } -#if wxUSE_SOCKETS - -#if defined(__WINDOWS__) - #include "wx/msw/gsockmsw.h" -#elif defined(__UNIX__) || defined(__DARWIN__) || defined(__OS2__) - #include "wx/unix/gsockunx.h" -#elif defined(__WXMAC__) - #include - #define OTUNIXERRORS 1 - #include - #include - #include - - #include "wx/mac/gsockmac.h" -#else - #error "Must include correct GSocket header here" -#endif - -GSocketGUIFunctionsTable* wxGUIAppTraitsBase::GetSocketGUIFunctionsTable() -{ - static GSocketGUIFunctionsTableConcrete table; - return &table; -} - -#endif diff --git a/src/common/fdiodispatcher.cpp b/src/common/fdiodispatcher.cpp index f526487130..65c862cf88 100644 --- a/src/common/fdiodispatcher.cpp +++ b/src/common/fdiodispatcher.cpp @@ -55,7 +55,7 @@ wxFDIODispatcher *wxFDIODispatcher::Get() #endif // wxUSE_EPOLL_DISPATCHER #if wxUSE_SELECT_DISPATCHER gs_dispatcher = wxSelectDispatcher::Create(); -#endif // wxUSE_WCHAR_T +#endif // wxUSE_SELECT_DISPATCHER } wxASSERT_MSG( gs_dispatcher, _T("failed to create any IO dispatchers") ); diff --git a/src/common/gsocketiohandler.cpp b/src/common/gsocketiohandler.cpp index ece535c02c..f31a6ecf99 100644 --- a/src/common/gsocketiohandler.cpp +++ b/src/common/gsocketiohandler.cpp @@ -5,6 +5,7 @@ // Created: 08.24.06 // RCS-ID: $Id$ // Copyright: (c) 2006 Angel vidal +// (c) 2007 Vadim Zeitlin // License: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -21,205 +22,114 @@ #if wxUSE_SOCKETS && wxUSE_SELECT_DISPATCHER -#include "wx/private/gsocketiohandler.h" +#include "wx/apptrait.h" #include "wx/unix/private.h" -#include "wx/gsocket.h" -#include "wx/unix/gsockunx.h" +#include "wx/private/gsocketiohandler.h" // ============================================================================ // implementation // ============================================================================ // ---------------------------------------------------------------------------- -// wxGSocketIOHandler +// GSocketSelectManager // ---------------------------------------------------------------------------- -wxGSocketIOHandler::wxGSocketIOHandler(GSocket* socket) - : m_socket(socket), - m_flags(0) +class GSocketSelectManager : public GSocketFDBasedManager { +public: + virtual void Install_Callback(GSocket *socket, GSocketEvent event); + virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event); +}; -} - -void wxGSocketIOHandler::OnReadWaiting() +void GSocketSelectManager::Install_Callback(GSocket *socket, + GSocketEvent event) { - m_socket->Detected_Read(); -} + const int fd = socket->m_fd; -void wxGSocketIOHandler::OnWriteWaiting() -{ - m_socket->Detected_Write(); -} + if ( fd == -1 ) + return; -void wxGSocketIOHandler::OnExceptionWaiting() -{ - m_socket->Detected_Read(); -} + const SocketDir d = GetDirForEvent(socket, event); -int wxGSocketIOHandler::GetFlags() const -{ - return m_flags; -} + wxFDIODispatcher * const dispatcher = wxFDIODispatcher::Get(); + if ( !dispatcher ) + return; + wxGSocketIOHandler *& handler = socket->m_handler; -void wxGSocketIOHandler::RemoveFlag(wxFDIODispatcherEntryFlags flag) -{ - m_flags &= ~flag; -} + // we should register the new handlers but modify the existing ones in place + bool registerHandler; + if ( handler ) + { + registerHandler = false; + } + else // no existing handler + { + registerHandler = true; + handler = new wxGSocketIOHandler(socket); + } -void wxGSocketIOHandler::AddFlag(wxFDIODispatcherEntryFlags flag) -{ - m_flags |= flag; -} + FD(socket, d) = fd; + if (d == FD_INPUT) + { + handler->AddFlag(wxFDIO_INPUT); + } + else + { + handler->AddFlag(wxFDIO_OUTPUT); + } -// ---------------------------------------------------------------------------- -// GSocket interface -// ---------------------------------------------------------------------------- - -bool GSocketGUIFunctionsTableConcrete::CanUseEventLoop() -{ - return true; -} - -bool GSocketGUIFunctionsTableConcrete::OnInit() -{ - return true; -} - -void GSocketGUIFunctionsTableConcrete::OnExit() -{ + if ( registerHandler ) + dispatcher->RegisterFD(fd, handler, handler->GetFlags()); + else + dispatcher->ModifyFD(fd, handler, handler->GetFlags()); } -bool GSocketGUIFunctionsTableConcrete::Init_Socket(GSocket *socket) +void GSocketSelectManager::Uninstall_Callback(GSocket *socket, + GSocketEvent event) { - int *m_id; + const SocketDir d = GetDirForEvent(socket, event); - socket->m_gui_dependent = (char *)malloc(sizeof(int)*2); - m_id = (int *)(socket->m_gui_dependent); + const int fd = FD(socket, d); + if ( fd == -1 ) + return; - m_id[0] = -1; - m_id[1] = -1; + FD(socket, d) = -1; - return true; -} + const wxFDIODispatcherEntryFlags + flag = d == FD_INPUT ? wxFDIO_INPUT : wxFDIO_OUTPUT; -void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket) -{ - free(socket->m_gui_dependent); -} + wxFDIODispatcher * const dispatcher = wxFDIODispatcher::Get(); + if ( !dispatcher ) + return; -void GSocketGUIFunctionsTableConcrete::Install_Callback(GSocket *socket, - GSocketEvent event) -{ - int *m_id = (int *)(socket->m_gui_dependent); - const int fd = socket->m_fd; - - if ( fd == -1 ) - return; - - int c; - switch (event) - { - case GSOCK_LOST: /* fall-through */ - case GSOCK_INPUT: c = 0; break; - case GSOCK_OUTPUT: c = 1; break; - case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break; - default: return; - } - - wxFDIODispatcher * const dispatcher = wxFDIODispatcher::Get(); - if ( !dispatcher ) - return; - - wxGSocketIOHandler *& handler = socket->m_handler; - - // we should register the new handlers but modify the existing ones in place - bool registerHandler; - if ( handler ) - { - registerHandler = false; - } - else // no existing handler - { - registerHandler = true; - handler = new wxGSocketIOHandler(socket); - } - - if (c == 0) - { - m_id[0] = fd; - handler->AddFlag(wxFDIO_INPUT); - } - else - { - m_id[1] = fd; - handler->AddFlag(wxFDIO_OUTPUT); - } - - if ( registerHandler ) - dispatcher->RegisterFD(fd, handler, handler->GetFlags()); - else - dispatcher->ModifyFD(fd, handler, handler->GetFlags()); -} + wxGSocketIOHandler *& handler = socket->m_handler; + if ( handler ) + { + handler->RemoveFlag(flag); -void GSocketGUIFunctionsTableConcrete::Uninstall_Callback(GSocket *socket, - GSocketEvent event) -{ - int *m_id = (int *)(socket->m_gui_dependent); - int c; - - switch (event) - { - case GSOCK_LOST: /* fall-through */ - case GSOCK_INPUT: c = 0; break; - case GSOCK_OUTPUT: c = 1; break; - case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break; - default: return; - } - - if ( m_id[c] == -1 ) - return; - - int fd = m_id[c]; - m_id[c] = -1; - - const wxFDIODispatcherEntryFlags flag = c == 0 ? wxFDIO_INPUT : wxFDIO_OUTPUT; - - wxFDIODispatcher * const dispatcher = wxFDIODispatcher::Get(); - if ( !dispatcher ) - return; - - wxGSocketIOHandler *& handler = socket->m_handler; - if ( handler ) - { - handler->RemoveFlag(flag); - - if ( !handler->GetFlags() ) - { - dispatcher->UnregisterFD(fd); - delete handler; - } - else - { - dispatcher->ModifyFD(fd, handler, handler->GetFlags()); - } - } - else - { - dispatcher->UnregisterFD(fd); - } + if ( !handler->GetFlags() ) + { + dispatcher->UnregisterFD(fd); + delete handler; + socket->m_handler = NULL; + } + else + { + dispatcher->ModifyFD(fd, handler, handler->GetFlags()); + } + } + else + { + dispatcher->UnregisterFD(fd); + } } -void GSocketGUIFunctionsTableConcrete::Enable_Events(GSocket *socket) +GSocketManager *wxAppTraits::GetSocketManager() { - Install_Callback(socket, GSOCK_INPUT); - Install_Callback(socket, GSOCK_OUTPUT); -} + static GSocketSelectManager s_manager; -void GSocketGUIFunctionsTableConcrete::Disable_Events(GSocket *socket) -{ - Uninstall_Callback(socket, GSOCK_INPUT); - Uninstall_Callback(socket, GSOCK_OUTPUT); + return &s_manager; } #endif // wxUSE_SOCKETS diff --git a/src/common/selectdispatcher.cpp b/src/common/selectdispatcher.cpp index 9321e7c837..d3461b2b2f 100644 --- a/src/common/selectdispatcher.cpp +++ b/src/common/selectdispatcher.cpp @@ -96,14 +96,10 @@ bool wxSelectSets::SetFD(int fd, int flags) if ( flags & ms_flags[n] ) { wxFD_SET(fd, &m_fds[n]); - wxLogTrace(wxSelectDispatcher_Trace, - _T("Registered fd %d for %s events"), fd, ms_names[n]); } else if ( wxFD_ISSET(fd, (fd_set*) &m_fds[n]) ) { wxFD_CLR(fd, &m_fds[n]); - wxLogTrace(wxSelectDispatcher_Trace, - _T("Unregistered fd %d from %s events"), fd, ms_names[n]); } } @@ -124,6 +120,9 @@ void wxSelectSets::Handle(int fd, wxFDIOHandler& handler) const wxLogTrace(wxSelectDispatcher_Trace, _T("Got %s event on fd %d"), ms_names[n], fd); (handler.*ms_handlers[n])(); + // callback can modify sets and destroy handler + // this forces that one event can be processed at one time + return; } } } @@ -154,6 +153,8 @@ bool wxSelectDispatcher::RegisterFD(int fd, wxFDIOHandler *handler, int flags) if ( fd > m_maxFD ) m_maxFD = fd; + wxLogTrace(wxSelectDispatcher_Trace, + _T("Registered fd %d: input:%d, output:%d, exceptional:%d"), fd, (flags & wxFDIO_INPUT) == wxFDIO_INPUT, (flags & wxFDIO_OUTPUT), (flags & wxFDIO_EXCEPTION) == wxFDIO_EXCEPTION); return true; } @@ -164,6 +165,8 @@ bool wxSelectDispatcher::ModifyFD(int fd, wxFDIOHandler *handler, int flags) wxASSERT_MSG( fd <= m_maxFD, _T("logic error: registered fd > m_maxFD?") ); + wxLogTrace(wxSelectDispatcher_Trace, + _T("Modified fd %d: input:%d, output:%d, exceptional:%d"), fd, (flags & wxFDIO_INPUT) == wxFDIO_INPUT, (flags & wxFDIO_OUTPUT) == wxFDIO_OUTPUT, (flags & wxFDIO_EXCEPTION) == wxFDIO_EXCEPTION); return m_sets.SetFD(fd, flags); } @@ -186,11 +189,15 @@ bool wxSelectDispatcher::UnregisterFD(int fd) ++it ) { if ( it->first > m_maxFD ) + { m_maxFD = it->first; + } } } } + wxLogTrace(wxSelectDispatcher_Trace, + _T("Removed fd %d, current max: %d"), fd, m_maxFD); return true; } diff --git a/src/common/socket.cpp b/src/common/socket.cpp index 825901734d..52aba80f2d 100644 --- a/src/common/socket.cpp +++ b/src/common/socket.cpp @@ -40,6 +40,7 @@ #include "wx/sckaddr.h" #include "wx/stopwatch.h" #include "wx/thread.h" +#include "wx/evtloop.h" // DLL options compatibility check: #include "wx/build.h" @@ -101,6 +102,50 @@ public: DECLARE_NO_COPY_CLASS(wxSocketState) }; +// ============================================================================ +// GSocketManager +// ============================================================================ + +GSocketManager *GSocketManager::ms_manager = NULL; + +/* static */ +void GSocketManager::Set(GSocketManager *manager) +{ + wxASSERT_MSG( !ms_manager, "too late to set manager now" ); + + ms_manager = manager; +} + +/* static */ +void GSocketManager::Init() +{ + wxASSERT_MSG( !ms_manager, "shouldn't be initialized twice" ); + + /* + Details: Initialize() creates a hidden window as a sink for socket + events, such as 'read completed'. wxMSW has only one message loop + for the main thread. If Initialize is called in a secondary thread, + the socket window will be created for the secondary thread, but + since there is no message loop on this thread, it will never + receive events and all socket operations will time out. + BTW, the main thread must not be stopped using sleep or block + on a semaphore (a bad idea in any case) or socket operations + will time out. + + On the Mac side, Initialize() stores a pointer to the CFRunLoop for + the main thread. Because secondary threads do not have run loops, + adding event notifications to the "Current" loop would have no + effect at all, events would never fire. + */ + wxASSERT_MSG( wxIsMainThread(), + "sockets must be initialized from the main thread" ); + + wxAppConsole * const app = wxAppConsole::GetInstance(); + wxCHECK_RET( app, "sockets can't be initialized without wxApp" ); + + ms_manager = app->GetTraits()->GetSocketManager(); +} + // ========================================================================== // wxSocketBase // ========================================================================== @@ -122,31 +167,6 @@ bool wxSocketBase::Initialize() { if ( !m_countInit++ ) { - /* - Details: Initialize() creates a hidden window as a sink for socket - events, such as 'read completed'. wxMSW has only one message loop - for the main thread. If Initialize is called in a secondary thread, - the socket window will be created for the secondary thread, but - since there is no message loop on this thread, it will never - receive events and all socket operations will time out. - BTW, the main thread must not be stopped using sleep or block - on a semaphore (a bad idea in any case) or socket operations - will time out. - - On the Mac side, Initialize() stores a pointer to the CFRunLoop for - the main thread. Because secondary threads do not have run loops, - adding event notifications to the "Current" loop would have no - effect at all, events would never fire. - */ - wxASSERT_MSG( wxIsMainThread(), - wxT("Call wxSocketBase::Initialize() from the main thread first!")); - - wxAppTraits *traits = wxAppConsole::GetInstance() ? - wxAppConsole::GetInstance()->GetTraits() : NULL; - GSocketGUIFunctionsTable *functions = - traits ? traits->GetSocketGUIFunctionsTable() : NULL; - GSocket_SetGUIFunctions(functions); - if ( !GSocket_Init() ) { m_countInit--; @@ -161,7 +181,7 @@ bool wxSocketBase::Initialize() void wxSocketBase::Shutdown() { // we should be initialized - wxASSERT_MSG( m_countInit, _T("extra call to Shutdown()") ); + wxASSERT_MSG( m_countInit > 0, _T("extra call to Shutdown()") ); if ( --m_countInit == 0 ) { GSocket_Cleanup(); @@ -695,7 +715,9 @@ bool wxSocketBase::_Wait(long seconds, else timeout = m_timeout * 1000; - bool has_event_loop = wxTheApp->GetTraits() ? (wxTheApp->GetTraits()->GetSocketGUIFunctionsTable() ? true : false) : false; + // check if we are using event loop or not: normally we do in GUI but not in + // console applications but this can be overridden + const bool has_event_loop = wxEventLoop::GetActive() != NULL; // Wait in an active polling loop. // @@ -1009,6 +1031,8 @@ void wxSocketBase::OnRequest(wxSocketNotify notification) void wxSocketBase::Notify(bool notify) { m_notify = notify; + if (m_socket) + m_socket->Notify(notify); } void wxSocketBase::SetNotify(wxSocketEventFlags flags) @@ -1096,8 +1120,8 @@ wxSocketServer::wxSocketServer(const wxSockAddress& addr_man, return; } - // Setup the socket as server - + // Setup the socket as server + m_socket->Notify(m_notify); m_socket->SetLocal(addr_man.GetAddress()); if (GetFlags() & wxSOCKET_REUSEADDR) { @@ -1123,6 +1147,8 @@ wxSocketServer::wxSocketServer(const wxSockAddress& addr_man, m_socket->SetCallback(GSOCK_INPUT_FLAG | GSOCK_OUTPUT_FLAG | GSOCK_LOST_FLAG | GSOCK_CONNECTION_FLAG, wx_socket_callback, (char *)this); + + wxLogTrace( wxTRACE_Socket, _T("wxSocketServer on fd %d"), m_socket->m_fd ); } // -------------------------------------------------------------------------- @@ -1310,6 +1336,9 @@ bool wxSocketClient::DoConnect(wxSockAddress& addr_man, wxSockAddress* local, bo m_socket->SetPeer(addr_man.GetAddress()); err = m_socket->Connect(GSOCK_STREAMED); + //this will register for callbacks - must be called after m_socket->m_fd was initialized + m_socket->Notify(m_notify); + if (!wait) m_socket->SetNonBlocking(0); @@ -1365,6 +1394,7 @@ wxDatagramSocket::wxDatagramSocket( const wxSockAddress& addr, wxFAIL_MSG( _T("datagram socket not new'd") ); return; } + m_socket->Notify(m_notify); // Setup the socket as non connection oriented m_socket->SetLocal(addr.GetAddress()); if (flags & wxSOCKET_REUSEADDR) diff --git a/src/gtk/gsockgtk.cpp b/src/gtk/gsockgtk.cpp index b38c4d7759..9a284628e1 100644 --- a/src/gtk/gsockgtk.cpp +++ b/src/gtk/gsockgtk.cpp @@ -1,17 +1,18 @@ -/* ------------------------------------------------------------------------- - * Project: GSocket (Generic Socket) for WX - * Name: src/gtk/gsockgtk.cpp - * Purpose: GSocket: GTK part - * Licence: The wxWindows licence - * CVSID: $Id$ - * ------------------------------------------------------------------------- - */ +/////////////////////////////////////////////////////////////////////////////// +// Name: gtk/gsockgtk.cpp +// Purpose: implementation of wxGTK-specific socket event handling +// Author: Guilhem Lavaux, Vadim Zeitlin +// Created: 1999 +// RCS-ID: $Id$ +// Copyright: (c) 1999, 2007 wxWidgets dev team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #if wxUSE_SOCKETS -#include #include #include @@ -19,8 +20,7 @@ #include #include "wx/gsocket.h" -#include "wx/unix/gsockunx.h" - +#include "wx/apptrait.h" extern "C" { static @@ -37,95 +37,30 @@ void _GSocket_GDK_Input(gpointer data, } } -bool GSocketGUIFunctionsTableConcrete::CanUseEventLoop() -{ return true; } - -bool GSocketGUIFunctionsTableConcrete::OnInit(void) -{ - return 1; -} - -void GSocketGUIFunctionsTableConcrete::OnExit(void) -{ -} - -bool GSocketGUIFunctionsTableConcrete::Init_Socket(GSocket *socket) +class GTKSocketManager : public GSocketInputBasedManager { - gint *m_id; - - socket->m_gui_dependent = (char *)malloc(sizeof(gint)*2); - m_id = (gint *)(socket->m_gui_dependent); - - m_id[0] = -1; - m_id[1] = -1; - - return TRUE; -} - -void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket) -{ - free(socket->m_gui_dependent); -} - -void GSocketGUIFunctionsTableConcrete::Install_Callback(GSocket *socket, GSocketEvent event) -{ - gint *m_id = (gint *)(socket->m_gui_dependent); - int c; - - if (socket->m_fd == -1) - return; - - switch (event) - { - case GSOCK_LOST: /* fall-through */ - case GSOCK_INPUT: c = 0; break; - case GSOCK_OUTPUT: c = 1; break; - case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break; - default: return; - } - - if (m_id[c] != -1) - gdk_input_remove(m_id[c]); - - m_id[c] = gdk_input_add(socket->m_fd, - (c ? GDK_INPUT_WRITE : GDK_INPUT_READ), - _GSocket_GDK_Input, - (gpointer)socket); -} - -void GSocketGUIFunctionsTableConcrete::Uninstall_Callback(GSocket *socket, GSocketEvent event) -{ - gint *m_id = (gint *)(socket->m_gui_dependent); - int c; - - assert( m_id != NULL ); - - switch (event) - { - case GSOCK_LOST: /* fall-through */ - case GSOCK_INPUT: c = 0; break; - case GSOCK_OUTPUT: c = 1; break; - case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break; - default: return; - } - - if (m_id[c] != -1) - { - gdk_input_remove(m_id[c]); - m_id[c] = -1; - } -} - -void GSocketGUIFunctionsTableConcrete::Enable_Events(GSocket *socket) -{ - Install_Callback(socket, GSOCK_INPUT); - Install_Callback(socket, GSOCK_OUTPUT); -} - -void GSocketGUIFunctionsTableConcrete::Disable_Events(GSocket *socket) +public: + virtual int AddInput(GSocket *socket, SocketDir d) + { + return gdk_input_add + ( + socket->m_fd, + d == FD_OUTPUT ? GDK_INPUT_WRITE : GDK_INPUT_READ, + _GSocket_GDK_Input, + socket + ); + } + + virtual void RemoveInput(int fd) + { + gdk_input_remove(fd); + } +}; + +GSocketManager *wxGUIAppTraits::GetSocketManager() { - Uninstall_Callback(socket, GSOCK_INPUT); - Uninstall_Callback(socket, GSOCK_OUTPUT); + static GTKSocketManager s_manager; + return &s_manager; } #endif // wxUSE_SOCKETS diff --git a/src/gtk1/gsockgtk.cpp b/src/gtk1/gsockgtk.cpp index 6609441ee3..9a284628e1 100644 --- a/src/gtk1/gsockgtk.cpp +++ b/src/gtk1/gsockgtk.cpp @@ -1,17 +1,18 @@ -/* ------------------------------------------------------------------------- - * Project: GSocket (Generic Socket) for WX - * Name: src/gtk1/gsockgtk.cpp - * Purpose: GSocket: GTK part - * Licence: The wxWindows licence - * CVSID: $Id$ - * ------------------------------------------------------------------------- - */ +/////////////////////////////////////////////////////////////////////////////// +// Name: gtk/gsockgtk.cpp +// Purpose: implementation of wxGTK-specific socket event handling +// Author: Guilhem Lavaux, Vadim Zeitlin +// Created: 1999 +// RCS-ID: $Id$ +// Copyright: (c) 1999, 2007 wxWidgets dev team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// + // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #if wxUSE_SOCKETS -#include #include #include @@ -19,8 +20,7 @@ #include #include "wx/gsocket.h" -#include "wx/unix/gsockunx.h" - +#include "wx/apptrait.h" extern "C" { static @@ -37,100 +37,30 @@ void _GSocket_GDK_Input(gpointer data, } } -bool GSocketGUIFunctionsTableConcrete::CanUseEventLoop() -{ return true; } - -bool GSocketGUIFunctionsTableConcrete::OnInit(void) -{ - return 1; -} - -void GSocketGUIFunctionsTableConcrete::OnExit(void) -{ -} - -bool GSocketGUIFunctionsTableConcrete::Init_Socket(GSocket *socket) +class GTKSocketManager : public GSocketInputBasedManager { - gint *m_id; - - socket->m_gui_dependent = (char *)malloc(sizeof(gint)*2); - m_id = (gint *)(socket->m_gui_dependent); - - m_id[0] = -1; - m_id[1] = -1; - - return TRUE; -} - -void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket) +public: + virtual int AddInput(GSocket *socket, SocketDir d) + { + return gdk_input_add + ( + socket->m_fd, + d == FD_OUTPUT ? GDK_INPUT_WRITE : GDK_INPUT_READ, + _GSocket_GDK_Input, + socket + ); + } + + virtual void RemoveInput(int fd) + { + gdk_input_remove(fd); + } +}; + +GSocketManager *wxGUIAppTraits::GetSocketManager() { - free(socket->m_gui_dependent); + static GTKSocketManager s_manager; + return &s_manager; } -void GSocketGUIFunctionsTableConcrete::Install_Callback(GSocket *socket, GSocketEvent event) -{ - gint *m_id = (gint *)(socket->m_gui_dependent); - int c; - - if (socket->m_fd == -1) - return; - - switch (event) - { - case GSOCK_LOST: /* fall-through */ - case GSOCK_INPUT: c = 0; break; - case GSOCK_OUTPUT: c = 1; break; - case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break; - default: return; - } - - if (m_id[c] != -1) - gdk_input_remove(m_id[c]); - - m_id[c] = gdk_input_add(socket->m_fd, - (c ? GDK_INPUT_WRITE : GDK_INPUT_READ), - _GSocket_GDK_Input, - (gpointer)socket); -} - -void GSocketGUIFunctionsTableConcrete::Uninstall_Callback(GSocket *socket, GSocketEvent event) -{ - gint *m_id = (gint *)(socket->m_gui_dependent); - int c; - - assert( m_id != NULL ); - - switch (event) - { - case GSOCK_LOST: /* fall-through */ - case GSOCK_INPUT: c = 0; break; - case GSOCK_OUTPUT: c = 1; break; - case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break; - default: return; - } - - if (m_id[c] != -1) - { - gdk_input_remove(m_id[c]); - m_id[c] = -1; - } -} - -void GSocketGUIFunctionsTableConcrete::Enable_Events(GSocket *socket) -{ - Install_Callback(socket, GSOCK_INPUT); - Install_Callback(socket, GSOCK_OUTPUT); -} - -void GSocketGUIFunctionsTableConcrete::Disable_Events(GSocket *socket) -{ - Uninstall_Callback(socket, GSOCK_INPUT); - Uninstall_Callback(socket, GSOCK_OUTPUT); -} - -#else /* !wxUSE_SOCKETS */ - -/* some compilers don't like having empty source files */ -static int wxDummyGsockVar = 0; - -#endif /* wxUSE_SOCKETS/!wxUSE_SOCKETS */ +#endif // wxUSE_SOCKETS diff --git a/src/mac/carbon/gsocket.cpp b/src/mac/carbon/gsocket.cpp index 1b14f7d3a0..123d9cd6b5 100644 --- a/src/mac/carbon/gsocket.cpp +++ b/src/mac/carbon/gsocket.cpp @@ -194,19 +194,11 @@ static void SetDefaultEndpointModes(EndpointRef ep , void *data ) */ } -/* Global initialisers */ - -void GSocket_SetGUIFunctions(GSocketGUIFunctionsTable *table) -{ - // do nothing, wxMac doesn't have wxBase-GUI separation yet -} - -int GSocket_Init() +bool GSocket_Init() { - return 1; + return true; } -bool GSocket_Verify_Inited() ; bool GSocket_Verify_Inited() { OSStatus err ; diff --git a/src/mac/corefoundation/gsockosx.cpp b/src/mac/corefoundation/gsockosx.cpp index afbf551477..695dab74ca 100644 --- a/src/mac/corefoundation/gsockosx.cpp +++ b/src/mac/corefoundation/gsockosx.cpp @@ -10,205 +10,309 @@ #if wxUSE_SOCKETS -#include #include "wx/gsocket.h" -#include "wx/unix/gsockunx.h" +#include "wx/apptrait.h" #include -#define ALL_CALLBACK_TYPES (kCFSocketReadCallBack | kCFSocketWriteCallBack | kCFSocketConnectCallBack) +// ---------------------------------------------------------------------------- +// Mac-specific data associated with each socket by GSocketCFManager +// ---------------------------------------------------------------------------- -struct MacGSocketData +class MacGSocketData { - CFSocketRef socket; - CFRunLoopSourceRef source; +public: + // default ctor creates the object in uninitialized state, use Initialize() + // later to make it usable + MacGSocketData() + { + m_socket = NULL; + m_source = NULL; + } + + // initialize the data associated with the given socket + bool Initialize(GSocket *socket) + { + wxASSERT_MSG( !IsInitialized(), "shouldn't be called twice" ); + + // we need a valid Unix socket to create a CFSocket + if ( socket->m_fd < 0 ) + return false; + + CFSocketContext cont; + cont.version = 0; // this currently must be 0 + cont.info = socket; // pointer passed to our callback + cont.retain = NULL; // no need to retain/release/copy the + cont.release = NULL; // socket pointer, so all callbacks + cont.copyDescription = NULL; // can be left NULL + + m_socket = CFSocketCreateWithNative + ( + NULL, // default allocator + socket->m_fd, + kCFSocketReadCallBack | + kCFSocketWriteCallBack | + kCFSocketConnectCallBack, + SocketCallback, + &cont + ); + if ( !m_socket ) + return false; + + m_source = CFSocketCreateRunLoopSource(NULL, m_socket, 0); + + return m_source != NULL; + } + + // free the objects created by Initialize() + ~MacGSocketData() + { + if ( m_source ) + CFRelease(m_source); + if ( m_socket ) + CFRelease(m_socket); + } + + // return true if Initialize() had already been called successfully + bool IsInitialized() const { return m_source && m_socket; } + + + // accessors: should only be called if IsInitialized() + CFSocketRef GetSocket() const + { + wxASSERT( IsInitialized() ); + + return m_socket; + } + + CFRunLoopSourceRef GetSource() const + { + wxASSERT( IsInitialized() ); + + return m_source; + } + +private: + static void SocketCallback(CFSocketRef WXUNUSED(s), + CFSocketCallBackType callbackType, + CFDataRef WXUNUSED(address), + const void* data, + void* info) + { + GSocket * const socket = wx_static_cast(GSocket *, info); + MacGSocketData * const + macdata = wx_static_cast(MacGSocketData *, socket->m_gui_dependent); + if ( !macdata ) + return; + + switch (callbackType) + { + case kCFSocketConnectCallBack: + wxASSERT(!socket->m_server); + // KH: If data is non-NULL, the connect failed, do not call Detected_Write, + // which will only end up creating a spurious connect event because the + // call to getsocketopt SO_ERROR inexplicably returns no error. + // The change in behavior cannot be traced to any particular commit or + // timeframe so I'm not sure what to think, but after so many hours, + // this seems to address the issue and it's time to move on. + if (data == NULL) + socket->Detected_Write(); + break; + + case kCFSocketReadCallBack: + socket->Detected_Read(); + break; + + case kCFSocketWriteCallBack: + socket->Detected_Write(); + break; + + default: + wxFAIL_MSG( "unexpected socket callback" ); + } + } + + CFSocketRef m_socket; + CFRunLoopSourceRef m_source; + + DECLARE_NO_COPY_CLASS(MacGSocketData); }; -// Sockets must use the event loop on the main thread -// We will store the main loop's reference when Initialize is called -static CFRunLoopRef s_mainRunLoop = NULL; +// ---------------------------------------------------------------------------- +// CoreFoundation implementation of GSocketManager +// ---------------------------------------------------------------------------- -void Mac_Socket_Callback(CFSocketRef WXUNUSED(s), CFSocketCallBackType callbackType, - CFDataRef WXUNUSED(address), const void* data, void* info) +class GSocketCFManager : public GSocketManager { - GSocket* socket = (GSocket*)info; - struct MacGSocketData* macdata; - macdata = (struct MacGSocketData*)socket->m_gui_dependent; - if (!macdata) return; - switch (callbackType) - { - case kCFSocketConnectCallBack: - assert(!socket->m_server); - // KH: If data is non-NULL, the connect failed, do not call Detected_Write, - // which will only end up creating a spurious connect event because the - // call to getsocketopt SO_ERROR inexplicably returns no error. - // The change in behavior cannot be traced to any particular commit or - // timeframe so I'm not sure what to think, but after so many hours, - // this seems to address the issue and it's time to move on. - if (data == NULL) - socket->Detected_Write(); - break; - case kCFSocketReadCallBack: - socket->Detected_Read(); - break; - case kCFSocketWriteCallBack: - socket->Detected_Write(); - break; - default: - break; /* We shouldn't get here. */ - } -} +public: + virtual bool OnInit(); + virtual void OnExit(); -struct MacGSocketData* _GSocket_Get_Mac_Socket(GSocket *socket) -{ - /* If socket is already created, returns a pointer to the data */ - /* Otherwise, creates socket and returns the pointer */ - CFSocketContext cont; - struct MacGSocketData* data = (struct MacGSocketData*)socket->m_gui_dependent; - - if (data && data->source) return data; - - /* CFSocket has not been created, create it: */ - if (socket->m_fd < 0 || !data) return NULL; - cont.version = 0; cont.retain = NULL; - cont.release = NULL; cont.copyDescription = NULL; - cont.info = socket; - - CFSocketRef cf = CFSocketCreateWithNative(NULL, socket->m_fd, - ALL_CALLBACK_TYPES, Mac_Socket_Callback, &cont); - CFRunLoopSourceRef source = CFSocketCreateRunLoopSource(NULL, cf, 0); - assert(source); - socket->m_gui_dependent = (char*)data; - - /* Keep the source and the socket around. */ - data->source = source; - data->socket = cf; - - return data; -} + virtual bool Init_Socket(GSocket *socket); + virtual void Destroy_Socket(GSocket *socket); + + virtual void Install_Callback(GSocket *socket, GSocketEvent event); + virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event); + + virtual void Enable_Events(GSocket *socket); + virtual void Disable_Events(GSocket *socket); -bool GSocketGUIFunctionsTableConcrete::CanUseEventLoop() -{ return true; } +private: + // retrieve our custom data associated with the given socket + // + // this is a low level function, use GetInitializedData() instead if the + // data pointer should also be correctly initialized if it hadn't been done + // yet + // + // may return NULL if we hadn't created the data for this socket yet + MacGSocketData *GetData(GSocket *socket) const + { + return wx_static_cast(MacGSocketData *, socket->m_gui_dependent); + } + + // return the custom data pointer initializing it if it hadn't been done + // yet + // + // may return NULL if there is no associated data + MacGSocketData *GetInitializedData(GSocket *socket) const + { + MacGSocketData * const data = GetData(socket); + if ( data && !data->IsInitialized() ) + { + if ( !data->Initialize(socket) ) + return NULL; + } + + return data; + } -bool GSocketGUIFunctionsTableConcrete::OnInit(void) + // return CFSocket callback mask corresponding to the given event (the + // socket parameter is needed because some events are interpreted + // differently depending on whether they happen on a server or on a client + // socket) + static int GetCFCallback(GSocket *socket, GSocketEvent event); + + + // Sockets must use the event loop on the main thread so we store a + // reference to the main loop here in OnInit() + static CFRunLoopRef ms_mainRunLoop; +}; + +CFRunLoopRef GSocketCFManager::ms_mainRunLoop = NULL; + +bool GSocketCFManager::OnInit() { // No need to store the main loop again - if (s_mainRunLoop != NULL) + if (ms_mainRunLoop != NULL) return true; // Get the loop for the main thread so our events will actually fire. // The common socket.cpp code will assert if initialize is called from a // secondary thread, otherwise Mac would have the same problems as MSW - s_mainRunLoop = CFRunLoopGetCurrent(); - CFRetain(s_mainRunLoop); + ms_mainRunLoop = CFRunLoopGetCurrent(); + if ( !ms_mainRunLoop ) + return false; + + CFRetain(ms_mainRunLoop); return true; } -void GSocketGUIFunctionsTableConcrete::OnExit(void) +void GSocketCFManager::OnExit() { // Release the reference count, and set the reference back to NULL - CFRelease(s_mainRunLoop); - s_mainRunLoop = NULL; + CFRelease(ms_mainRunLoop); + ms_mainRunLoop = NULL; } -bool GSocketGUIFunctionsTableConcrete::Init_Socket(GSocket *socket) +bool GSocketCFManager::Init_Socket(GSocket *socket) { - struct MacGSocketData *data = (struct MacGSocketData *)malloc(sizeof(struct MacGSocketData)); - if (data) - { - socket->m_gui_dependent = (char*)data; - data->socket = NULL; - data->source = NULL; - return 1; - } - return 0; + socket->m_gui_dependent = new MacGSocketData; + return true; } -void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket) +void GSocketCFManager::Destroy_Socket(GSocket *socket) { - struct MacGSocketData *data = (struct MacGSocketData*)(socket->m_gui_dependent); - if (data) + MacGSocketData * const data = GetData(socket); + if ( data ) { - if ( data->source ) - CFRelease(data->source); - if ( data->socket ) - CFRelease(data->socket); - free(data); + delete data; + socket->m_gui_dependent = NULL; } } -void GSocketGUIFunctionsTableConcrete::Install_Callback(GSocket *socket, GSocketEvent event) +/* static */ +int GSocketCFManager::GetCFCallback(GSocket *socket, GSocketEvent event) { - int c; - struct MacGSocketData* data = _GSocket_Get_Mac_Socket(socket); - if (!data) return; - switch (event) + switch ( event ) { - case GSOCK_CONNECTION: - if(socket->m_server) - c = kCFSocketReadCallBack; - else - c = kCFSocketConnectCallBack; - break; - case GSOCK_LOST: - case GSOCK_INPUT: - c = kCFSocketReadCallBack; - break; - case GSOCK_OUTPUT: - c = kCFSocketWriteCallBack; - break; - default: - c = 0; + case GSOCK_CONNECTION: + return socket->m_server ? kCFSocketReadCallBack + : kCFSocketConnectCallBack; + + case GSOCK_LOST: + case GSOCK_INPUT: + return kCFSocketReadCallBack; + + case GSOCK_OUTPUT: + return kCFSocketWriteCallBack; + + case GSOCK_MAX_EVENT: + wxFAIL_MSG( "invalid GSocketEvent" ); + return 0; + + default: + wxFAIL_MSG( "unknown GSocketEvent" ); + return 0; } - CFSocketEnableCallBacks(data->socket, c); } -void GSocketGUIFunctionsTableConcrete::Uninstall_Callback(GSocket *socket, GSocketEvent event) +void GSocketCFManager::Install_Callback(GSocket *socket, GSocketEvent event) { - int c; - struct MacGSocketData* data = _GSocket_Get_Mac_Socket(socket); - if (!data) return; - switch (event) - { - case GSOCK_CONNECTION: - if(socket->m_server) - c = kCFSocketReadCallBack; - else - c = kCFSocketConnectCallBack; - break; - case GSOCK_LOST: - case GSOCK_INPUT: - c = kCFSocketReadCallBack; - break; - case GSOCK_OUTPUT: - c = kCFSocketWriteCallBack; - break; - default: - c = 0; - } - CFSocketDisableCallBacks(data->socket, c); + const MacGSocketData * const data = GetInitializedData(socket); + if ( !data ) + return; + + CFSocketEnableCallBacks(data->GetSocket(), GetCFCallback(socket, event)); } -void GSocketGUIFunctionsTableConcrete::Enable_Events(GSocket *socket) +void GSocketCFManager::Uninstall_Callback(GSocket *socket, GSocketEvent event) { - struct MacGSocketData* data = _GSocket_Get_Mac_Socket(socket); - if (!data) return; + const MacGSocketData * const data = GetInitializedData(socket); + if ( !data ) + return; - CFRunLoopAddSource(s_mainRunLoop, data->source, kCFRunLoopCommonModes); + CFSocketDisableCallBacks(data->GetSocket(), GetCFCallback(socket, event)); } -void GSocketGUIFunctionsTableConcrete::Disable_Events(GSocket *socket) +void GSocketCFManager::Enable_Events(GSocket *socket) { - struct MacGSocketData* data = _GSocket_Get_Mac_Socket(socket); - if (!data) return; + const MacGSocketData * const data = GetInitializedData(socket); + if ( !data ) + return; - /* CFSocketInvalidate does CFRunLoopRemoveSource anyway */ - CFRunLoopRemoveSource(s_mainRunLoop, data->source, kCFRunLoopCommonModes); - CFSocketInvalidate(data->socket); + CFRunLoopAddSource(ms_mainRunLoop, data->GetSource(), kCFRunLoopCommonModes); +} + +void GSocketCFManager::Disable_Events(GSocket *socket) +{ + const MacGSocketData * const data = GetInitializedData(socket); + if ( !data ) + return; + + // CFSocketInvalidate does CFRunLoopRemoveSource anyway + CFRunLoopRemoveSource(ms_mainRunLoop, data->GetSource(), kCFRunLoopCommonModes); + CFSocketInvalidate(data->GetSocket()); // CFSocketInvalidate has closed the socket so we want to make sure GSocket knows this - socket->m_fd = -1 /*INVALID_SOCKET*/; + socket->m_fd = -1; } +GSocketManager *wxAppTraits::GetSocketManager() +{ + static GSocketCFManager s_manager; + + return &s_manager; +}; + #endif // wxUSE_SOCKETS diff --git a/src/motif/gsockmot.cpp b/src/motif/gsockmot.cpp index ef711c8c3e..238c0cbca8 100644 --- a/src/motif/gsockmot.cpp +++ b/src/motif/gsockmot.cpp @@ -1,22 +1,24 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: src/motif/gsockmot.cpp -// Project: GSocket (Generic Socket) for WX -// Purpose: GSocket: Motif part -// CVSID: $Id$ -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// +// Name: motif/gsockmot.cpp +// Purpose: implementation of wxMotif-specific socket event handling +// Author: Guilhem Lavaux, Vadim Zeitlin +// Created: 1999 +// RCS-ID: $Id$ +// Copyright: (c) 1999, 2007 wxWidgets dev team +// Licence: wxWindows licence +/////////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #if wxUSE_SOCKETS -#include -#include +#include // XtAppAdd/RemoveInput() +#include "wx/motif/private.h" // wxGetAppContext() #include "wx/gsocket.h" -#include "wx/unix/gsockunx.h" +#include "wx/apptrait.h" -extern "C" XtAppContext wxGetAppContext(); +extern "C" { static void _GSocket_Motif_Input(XtPointer data, int *WXUNUSED(fid), XtInputId *WXUNUSED(id)) @@ -34,109 +36,35 @@ static void _GSocket_Motif_Output(XtPointer data, int *WXUNUSED(fid), socket->Detected_Write(); } -bool GSocketGUIFunctionsTableConcrete::CanUseEventLoop() -{ - return true; -} - -bool GSocketGUIFunctionsTableConcrete::OnInit(void) -{ - return 1; -} - -void GSocketGUIFunctionsTableConcrete::OnExit(void) -{ -} - -bool GSocketGUIFunctionsTableConcrete::Init_Socket(GSocket *socket) -{ - int *m_id; - - socket->m_gui_dependent = (char *)malloc(sizeof(int)*2); - m_id = (int *)(socket->m_gui_dependent); - - m_id[0] = -1; - m_id[1] = -1; - - return true; } -void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket) +class MotifSocketManager : public GSocketInputBasedManager { - free(socket->m_gui_dependent); -} - -void GSocketGUIFunctionsTableConcrete::Install_Callback(GSocket *socket, GSocketEvent event) -{ - int *m_id = (int *)(socket->m_gui_dependent); - int c; - - if (socket->m_fd == -1) - return; - - switch (event) +public: + virtual int AddInput(GSocket *socket, SocketDir d) { - case GSOCK_LOST: /* fall-through */ - case GSOCK_INPUT: c = 0; break; - case GSOCK_OUTPUT: c = 1; break; - case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break; - default: return; + return XtAppAddInput + ( + wxGetAppContext(), + socket->m_fd, + (XtPointer)(d == FD_OUTPUT ? XtInputWriteMask + : XtInputReadMask), + d == FD_OUTPUT ? _GSocket_Motif_Output + : _GSocket_Motif_Input, + socket + ); } - if (m_id[c] != -1) - XtRemoveInput(m_id[c]); - - if (c == 0) - { - m_id[0] = XtAppAddInput(wxGetAppContext(), socket->m_fd, - (XtPointer *)XtInputReadMask, - (XtInputCallbackProc) _GSocket_Motif_Input, - (XtPointer) socket); - } - else + virtual void RemoveInput(int fd) { - m_id[1] = XtAppAddInput(wxGetAppContext(), socket->m_fd, - (XtPointer *)XtInputWriteMask, - (XtInputCallbackProc) _GSocket_Motif_Output, - (XtPointer) socket); + XtRemoveInput(fd); } -} +}; -void GSocketGUIFunctionsTableConcrete::Uninstall_Callback(GSocket *socket, GSocketEvent event) +GSocketManager *wxGUIAppTraits::GetSocketManager() { - int *m_id = (int *)(socket->m_gui_dependent); - int c; - - switch (event) - { - case GSOCK_LOST: /* fall-through */ - case GSOCK_INPUT: c = 0; break; - case GSOCK_OUTPUT: c = 1; break; - case GSOCK_CONNECTION: c = ((socket->m_server) ? 0 : 1); break; - default: return; - } - - if (m_id[c] != -1) - XtRemoveInput(m_id[c]); - - m_id[c] = -1; + static MotifSocketManager s_manager; + return &s_manager; } -void GSocketGUIFunctionsTableConcrete::Enable_Events(GSocket *socket) -{ - Install_Callback(socket, GSOCK_INPUT); - Install_Callback(socket, GSOCK_OUTPUT); -} - -void GSocketGUIFunctionsTableConcrete::Disable_Events(GSocket *socket) -{ - Uninstall_Callback(socket, GSOCK_INPUT); - Uninstall_Callback(socket, GSOCK_OUTPUT); -} - -#else /* !wxUSE_SOCKETS */ - -/* some compilers don't like having empty source files */ -static int wxDummyGsockVar = 0; - -#endif /* wxUSE_SOCKETS/!wxUSE_SOCKETS */ +#endif // wxUSE_SOCKETS diff --git a/src/msw/basemsw.cpp b/src/msw/basemsw.cpp index 4ba9b8b091..5308abebe3 100644 --- a/src/msw/basemsw.cpp +++ b/src/msw/basemsw.cpp @@ -41,6 +41,8 @@ // wxAppTraits implementation // ============================================================================ +GSocketManager *wxAppTraits::ms_manager = NULL; + WXDWORD wxAppTraits::DoSimpleWaitForThread(WXHANDLE hThread) { return ::WaitForSingleObject((HANDLE)hThread, INFINITE); diff --git a/src/msw/evtloop.cpp b/src/msw/evtloop.cpp index 63f1688349..601b8b870b 100644 --- a/src/msw/evtloop.cpp +++ b/src/msw/evtloop.cpp @@ -332,7 +332,7 @@ bool wxConsoleEventLoop::Dispatch() } else { - wxLogDebug(_T("Ignoring unexpected message %d"), msg.message); + ::DispatchMessage(&msg); } return !m_shouldExit; diff --git a/src/msw/gsocket.cpp b/src/msw/gsocket.cpp index f71724d264..18d83b0434 100644 --- a/src/msw/gsocket.cpp +++ b/src/msw/gsocket.cpp @@ -53,24 +53,13 @@ #include -#ifndef __GSOCKET_STANDALONE__ -# include "wx/platform.h" -#endif +#include "wx/platform.h" -#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) +#if wxUSE_SOCKETS -#ifndef __GSOCKET_STANDALONE__ -# include "wx/msw/gsockmsw.h" -# include "wx/gsocket.h" -#else -# include "gsockmsw.h" -# include "gsocket.h" -#endif /* __GSOCKET_STANDALONE__ */ +#include "wx/gsocket.h" -#ifndef __WXWINCE__ -#include -#else -#define assert(x) +#ifdef __WXWINCE__ #ifndef isdigit #define isdigit(x) (x > 47 && x < 58) #endif @@ -94,69 +83,23 @@ typedef struct sockaddr_storage wxSockAddr; typedef struct sockaddr wxSockAddr; #endif - -/* Table of GUI-related functions. We must call them indirectly because - * of wxBase and GUI separation: */ - -static GSocketGUIFunctionsTable *gs_gui_functions; - -class GSocketGUIFunctionsTableNull: public GSocketGUIFunctionsTable -{ -public: - virtual bool OnInit(); - virtual void OnExit(); - virtual bool CanUseEventLoop(); - virtual bool Init_Socket(GSocket *socket); - virtual void Destroy_Socket(GSocket *socket); - virtual void Enable_Events(GSocket *socket); - virtual void Disable_Events(GSocket *socket); -}; - -bool GSocketGUIFunctionsTableNull::OnInit() -{ return true; } -void GSocketGUIFunctionsTableNull::OnExit() -{} -bool GSocketGUIFunctionsTableNull::CanUseEventLoop() -{ return false; } -bool GSocketGUIFunctionsTableNull::Init_Socket(GSocket *WXUNUSED(socket)) -{ return true; } -void GSocketGUIFunctionsTableNull::Destroy_Socket(GSocket *WXUNUSED(socket)) -{} -void GSocketGUIFunctionsTableNull::Enable_Events(GSocket *WXUNUSED(socket)) -{} -void GSocketGUIFunctionsTableNull::Disable_Events(GSocket *WXUNUSED(socket)) -{} -/* Global initialisers */ - -void GSocket_SetGUIFunctions(GSocketGUIFunctionsTable *guifunc) -{ - gs_gui_functions = guifunc; -} - -int GSocket_Init(void) +bool GSocket_Init() { WSADATA wsaData; - if (!gs_gui_functions) - { - static GSocketGUIFunctionsTableNull table; - gs_gui_functions = &table; - } - if ( !gs_gui_functions->OnInit() ) - { - return 0; - } + GSocketManager * const manager = GSocketManager::Get(); + if ( !manager || !manager->OnInit() ) + return false; /* Initialize WinSocket */ - return (WSAStartup((1 << 8) | 1, &wsaData) == 0); + return WSAStartup((1 << 8) | 1, &wsaData) == 0; } -void GSocket_Cleanup(void) +void GSocket_Cleanup() { - if (gs_gui_functions) - { - gs_gui_functions->OnExit(); - } + GSocketManager * const manager = GSocketManager::Get(); + if ( manager ) + manager->OnExit(); /* Cleanup WinSocket */ WSACleanup(); @@ -184,29 +127,24 @@ GSocket::GSocket() m_timeout.tv_usec = 0; m_establishing = false; m_reusable = false; - m_broadcast = false; + m_broadcast = false; m_dobind = true; m_initialRecvBufferSize = -1; m_initialSendBufferSize = -1; - assert(gs_gui_functions); - /* Per-socket GUI-specific initialization */ - m_ok = gs_gui_functions->Init_Socket(this); + m_ok = GSocketManager::Get()->Init_Socket(this); } void GSocket::Close() { - gs_gui_functions->Disable_Events(this); + GSocketManager::Get()->Disable_Events(this); closesocket(m_fd); m_fd = INVALID_SOCKET; } GSocket::~GSocket() { - assert(this); - - /* Per-socket GUI-specific cleanup */ - gs_gui_functions->Destroy_Socket(this); + GSocketManager::Get()->Destroy_Socket(this); /* Check that the socket is really shutdowned */ if (m_fd != INVALID_SOCKET) @@ -228,8 +166,6 @@ void GSocket::Shutdown() { int evt; - assert(this); - /* If socket has been created, shutdown it */ if (m_fd != INVALID_SOCKET) { @@ -262,8 +198,6 @@ void GSocket::Shutdown() */ GSocketError GSocket::SetLocal(GAddress *address) { - assert(this); - /* the socket must be initialized, or it must be a server */ if (m_fd != INVALID_SOCKET && !m_server) { @@ -288,8 +222,6 @@ GSocketError GSocket::SetLocal(GAddress *address) GSocketError GSocket::SetPeer(GAddress *address) { - assert(this); - /* check address */ if (address == NULL || address->m_family == GSOCK_NOFAMILY) { @@ -312,8 +244,6 @@ GAddress *GSocket::GetLocal() WX_SOCKLEN_T size = sizeof(addr); GSocketError err; - assert(this); - /* try to get it from the m_local var first */ if (m_local) return GAddress_copy(m_local); @@ -350,8 +280,6 @@ GAddress *GSocket::GetLocal() GAddress *GSocket::GetPeer() { - assert(this); - /* try to get it from the m_peer var */ if (m_peer) return GAddress_copy(m_peer); @@ -375,8 +303,6 @@ GSocketError GSocket::SetServer() { u_long arg = 1; - assert(this); - /* must not be in use */ if (m_fd != INVALID_SOCKET) { @@ -405,7 +331,7 @@ GSocketError GSocket::SetServer() } ioctlsocket(m_fd, FIONBIO, (u_long FAR *) &arg); - gs_gui_functions->Enable_Events(this); + GSocketManager::Get()->Enable_Events(this); /* allow a socket to re-bind if the socket is in the TIME_WAIT state after being previously closed. @@ -453,8 +379,6 @@ GSocket *GSocket::WaitConnection() GSocketError err; u_long arg = 1; - assert(this); - /* Reenable CONNECTION events */ m_detected &= ~GSOCK_CONNECTION_FLAG; @@ -517,7 +441,7 @@ GSocket *GSocket::WaitConnection() } ioctlsocket(connection->m_fd, FIONBIO, (u_long FAR *) &arg); - gs_gui_functions->Enable_Events(connection); + GSocketManager::Get()->Enable_Events(connection); return connection; } @@ -598,8 +522,6 @@ GSocketError GSocket::Connect(GSocketStream stream) int ret, err; u_long arg = 1; - assert(this); - /* Enable CONNECTION events (needed for nonblocking connections) */ m_detected &= ~GSOCK_CONNECTION_FLAG; @@ -631,7 +553,7 @@ GSocketError GSocket::Connect(GSocketStream stream) } ioctlsocket(m_fd, FIONBIO, (u_long FAR *) &arg); - gs_gui_functions->Enable_Events(this); + GSocketManager::Get()->Enable_Events(this); // If the reuse flag is set, use the applicable socket reuse flag if (m_reusable) @@ -716,8 +638,6 @@ GSocketError GSocket::SetNonOriented() { u_long arg = 1; - assert(this); - if (m_fd != INVALID_SOCKET) { m_error = GSOCK_INVSOCK; @@ -744,7 +664,7 @@ GSocketError GSocket::SetNonOriented() } ioctlsocket(m_fd, FIONBIO, (u_long FAR *) &arg); - gs_gui_functions->Enable_Events(this); + GSocketManager::Get()->Enable_Events(this); if (m_reusable) { @@ -780,8 +700,6 @@ int GSocket::Read(char *buffer, int size) { int ret; - assert(this); - /* Reenable INPUT events */ m_detected &= ~GSOCK_INPUT_FLAG; @@ -820,8 +738,6 @@ int GSocket::Write(const char *buffer, int size) { int ret; - assert(this); - if (m_fd == INVALID_SOCKET || m_server) { m_error = GSOCK_INVSOCK; @@ -866,107 +782,7 @@ int GSocket::Write(const char *buffer, int size) */ GSocketEventFlags GSocket::Select(GSocketEventFlags flags) { - if (!gs_gui_functions->CanUseEventLoop()) - { - GSocketEventFlags result = 0; - fd_set readfds; - fd_set writefds; - fd_set exceptfds; - - assert(this); - - FD_ZERO(&readfds); - FD_ZERO(&writefds); - FD_ZERO(&exceptfds); - FD_SET(m_fd, &readfds); - if (flags & GSOCK_OUTPUT_FLAG || flags & GSOCK_CONNECTION_FLAG) - FD_SET(m_fd, &writefds); - FD_SET(m_fd, &exceptfds); - - /* Check 'sticky' CONNECTION flag first */ - result |= (GSOCK_CONNECTION_FLAG & m_detected); - - /* If we have already detected a LOST event, then don't try - * to do any further processing. - */ - if ((m_detected & GSOCK_LOST_FLAG) != 0) - { - m_establishing = false; - - return (GSOCK_LOST_FLAG & flags); - } - - /* Try select now */ - if (select(m_fd + 1, &readfds, &writefds, &exceptfds, - &m_timeout) <= 0) - { - /* What to do here? */ - return (result & flags); - } - - /* Check for exceptions and errors */ - if (FD_ISSET(m_fd, &exceptfds)) - { - m_establishing = false; - m_detected = GSOCK_LOST_FLAG; - - /* LOST event: Abort any further processing */ - return (GSOCK_LOST_FLAG & flags); - } - - /* Check for readability */ - if (FD_ISSET(m_fd, &readfds)) - { - result |= GSOCK_INPUT_FLAG; - - if (m_server && m_stream) - { - /* This is a TCP server socket that detected a connection. - While the INPUT_FLAG is also set, it doesn't matter on - this kind of sockets, as we can only Accept() from them. */ - result |= GSOCK_CONNECTION_FLAG; - m_detected |= GSOCK_CONNECTION_FLAG; - } - } - - /* Check for writability */ - if (FD_ISSET(m_fd, &writefds)) - { - if (m_establishing && !m_server) - { - int error; - WX_SOCKLEN_T len = sizeof(error); - - m_establishing = false; - - getsockopt(m_fd, SOL_SOCKET, SO_ERROR, (char*)&error, &len); - - if (error) - { - m_detected = GSOCK_LOST_FLAG; - - /* LOST event: Abort any further processing */ - return (GSOCK_LOST_FLAG & flags); - } - else - { - result |= GSOCK_CONNECTION_FLAG; - m_detected |= GSOCK_CONNECTION_FLAG; - } - } - else - { - result |= GSOCK_OUTPUT_FLAG; - } - } - - return (result & flags); - } - else /* USE_GUI() */ - { - assert(this); - return flags & m_detected; - } + return flags & m_detected; } /* Attributes */ @@ -977,8 +793,6 @@ GSocketEventFlags GSocket::Select(GSocketEventFlags flags) */ void GSocket::SetNonBlocking(bool non_block) { - assert(this); - m_non_blocking = non_block; } @@ -988,8 +802,6 @@ void GSocket::SetNonBlocking(bool non_block) */ void GSocket::SetTimeout(unsigned long millis) { - assert(this); - m_timeout.tv_sec = (millis / 1000); m_timeout.tv_usec = (millis % 1000) * 1000; } @@ -1001,8 +813,6 @@ void GSocket::SetTimeout(unsigned long millis) */ GSocketError WXDLLIMPEXP_NET GSocket::GetError() { - assert(this); - return m_error; } @@ -1041,8 +851,6 @@ void GSocket::SetCallback(GSocketEventFlags flags, { int count; - assert(this); - for (count = 0; count < GSOCK_MAX_EVENT; count++) { if ((flags & (1 << count)) != 0) @@ -1061,8 +869,6 @@ void GSocket::UnsetCallback(GSocketEventFlags flags) { int count; - assert(this); - for (count = 0; count < GSOCK_MAX_EVENT; count++) { if ((flags & (1 << count)) != 0) @@ -1236,7 +1042,7 @@ int GSocket::Send_Dgram(const char *buffer, int size) } /* Compatibility functions for GSocket */ -GSocket *GSocket_new(void) +GSocket *GSocket_new() { GSocket *newsocket = new GSocket(); if(newsocket->IsOk()) @@ -1284,7 +1090,7 @@ GSocket *GSocket_new(void) } -GAddress *GAddress_new(void) +GAddress *GAddress_new() { GAddress *address; @@ -1302,8 +1108,6 @@ GAddress *GAddress_copy(GAddress *address) { GAddress *addr2; - assert(address != NULL); - if ((addr2 = (GAddress *) malloc(sizeof(GAddress))) == NULL) return NULL; @@ -1325,8 +1129,6 @@ GAddress *GAddress_copy(GAddress *address) void GAddress_destroy(GAddress *address) { - assert(address != NULL); - if (address->m_addr) free(address->m_addr); @@ -1335,15 +1137,11 @@ void GAddress_destroy(GAddress *address) void GAddress_SetFamily(GAddress *address, GAddressType type) { - assert(address != NULL); - address->m_family = type; } GAddressType GAddress_GetFamily(GAddress *address) { - assert(address != NULL); - return address->m_family; } @@ -1437,8 +1235,6 @@ GSocketError GAddress_INET_SetHostName(GAddress *address, const char *hostname) struct hostent *he; struct in_addr *addr; - assert(address != NULL); - CHECK_ADDRESS(address, INET); addr = &(((struct sockaddr_in *)address->m_addr)->sin_addr); @@ -1478,8 +1274,6 @@ GSocketError GAddress_INET_SetHostAddress(GAddress *address, { struct in_addr *addr; - assert(address != NULL); - CHECK_ADDRESS(address, INET); addr = &(((struct sockaddr_in *)address->m_addr)->sin_addr); @@ -1494,7 +1288,6 @@ GSocketError GAddress_INET_SetPortName(GAddress *address, const char *port, struct servent *se; struct sockaddr_in *addr; - assert(address != NULL); CHECK_ADDRESS(address, INET); if (!port) @@ -1530,7 +1323,6 @@ GSocketError GAddress_INET_SetPort(GAddress *address, unsigned short port) { struct sockaddr_in *addr; - assert(address != NULL); CHECK_ADDRESS(address, INET); addr = (struct sockaddr_in *)address->m_addr; @@ -1545,7 +1337,6 @@ GSocketError GAddress_INET_GetHostName(GAddress *address, char *hostname, size_t char *addr_buf; struct sockaddr_in *addr; - assert(address != NULL); CHECK_ADDRESS(address, INET); addr = (struct sockaddr_in *)address->m_addr; @@ -1567,7 +1358,6 @@ unsigned long GAddress_INET_GetHostAddress(GAddress *address) { struct sockaddr_in *addr; - assert(address != NULL); CHECK_ADDRESS_RETVAL(address, INET, 0); addr = (struct sockaddr_in *)address->m_addr; @@ -1579,7 +1369,6 @@ unsigned short GAddress_INET_GetPort(GAddress *address) { struct sockaddr_in *addr; - assert(address != NULL); CHECK_ADDRESS_RETVAL(address, INET, 0); addr = (struct sockaddr_in *)address->m_addr; @@ -1621,7 +1410,6 @@ GSocketError _GAddress_Init_INET6(GAddress *address) GSocketError GAddress_INET6_SetHostName(GAddress *address, const char *hostname) { - assert(address != NULL); CHECK_ADDRESS(address, INET6); addrinfo hints; @@ -1641,8 +1429,6 @@ GSocketError GAddress_INET6_SetHostName(GAddress *address, const char *hostname) GSocketError GAddress_INET6_SetAnyAddress(GAddress *address) { - assert(address != NULL); - CHECK_ADDRESS(address, INET6); struct in6_addr addr; @@ -1652,8 +1438,6 @@ GSocketError GAddress_INET6_SetAnyAddress(GAddress *address) GSocketError GAddress_INET6_SetHostAddress(GAddress *address, struct in6_addr hostaddr) { - assert(address != NULL); - CHECK_ADDRESS(address, INET6); ((struct sockaddr_in6 *)address->m_addr)->sin6_addr = hostaddr; @@ -1667,7 +1451,6 @@ GSocketError GAddress_INET6_SetPortName(GAddress *address, const char *port, struct servent *se; struct sockaddr_in6 *addr; - assert(address != NULL); CHECK_ADDRESS(address, INET6); if (!port) @@ -1703,7 +1486,6 @@ GSocketError GAddress_INET6_SetPort(GAddress *address, unsigned short port) { struct sockaddr_in6 *addr; - assert(address != NULL); CHECK_ADDRESS(address, INET6); addr = (struct sockaddr_in6 *)address->m_addr; @@ -1718,7 +1500,6 @@ GSocketError GAddress_INET6_GetHostName(GAddress *address, char *hostname, size_ char *addr_buf; struct sockaddr_in6 *addr; - assert(address != NULL); CHECK_ADDRESS(address, INET6); addr = (struct sockaddr_in6 *)address->m_addr; @@ -1738,8 +1519,6 @@ GSocketError GAddress_INET6_GetHostName(GAddress *address, char *hostname, size_ GSocketError GAddress_INET6_GetHostAddress(GAddress *address,struct in6_addr *hostaddr) { - assert(address != NULL); - assert(hostaddr != NULL); CHECK_ADDRESS_RETVAL(address, INET6, GSOCK_INVADDR); *hostaddr = ( (struct sockaddr_in6 *)address->m_addr )->sin6_addr; return GSOCK_NOERROR; @@ -1747,7 +1526,6 @@ GSocketError GAddress_INET6_GetHostAddress(GAddress *address,struct in6_addr *ho unsigned short GAddress_INET6_GetPort(GAddress *address) { - assert(address != NULL); CHECK_ADDRESS_RETVAL(address, INET6, 0); return ntohs( ((struct sockaddr_in6 *)address->m_addr)->sin6_port ); @@ -1763,31 +1541,20 @@ unsigned short GAddress_INET6_GetPort(GAddress *address) GSocketError _GAddress_Init_UNIX(GAddress *address) { - assert (address != NULL); address->m_error = GSOCK_INVADDR; return GSOCK_INVADDR; } GSocketError GAddress_UNIX_SetPath(GAddress *address, const char *WXUNUSED(path)) { - assert (address != NULL); address->m_error = GSOCK_INVADDR; return GSOCK_INVADDR; } GSocketError GAddress_UNIX_GetPath(GAddress *address, char *WXUNUSED(path), size_t WXUNUSED(sbuf)) { - assert (address != NULL); address->m_error = GSOCK_INVADDR; return GSOCK_INVADDR; } -#else /* !wxUSE_SOCKETS */ - -/* - * Translation unit shouldn't be empty, so include this typedef to make the - * compiler (VC++ 6.0, for example) happy - */ -typedef void (*wxDummy)(); - -#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ +#endif // wxUSE_SOCKETS diff --git a/src/msw/gsockmsw.cpp b/src/msw/gsockmsw.cpp index 12ae969e4c..a1ada1918b 100644 --- a/src/msw/gsockmsw.cpp +++ b/src/msw/gsockmsw.cpp @@ -16,6 +16,8 @@ #pragma hdrstop #endif +#if wxUSE_SOCKETS + /* * DONE: for WinCE we need to replace WSAAsyncSelect * (Windows message-based notification of network events for a socket) @@ -34,54 +36,13 @@ # pragma warning(disable:4115) /* named type definition in parentheses */ #endif -/* This needs to be before the wx/defs/h inclusion - * for some reason - */ - -#ifdef __WXWINCE__ - /* windows.h results in tons of warnings at max warning level */ -# ifdef _MSC_VER -# pragma warning(push, 1) -# endif -# include -# ifdef _MSC_VER -# pragma warning(pop) -# pragma warning(disable:4514) -# endif -#endif - -#ifndef __GSOCKET_STANDALONE__ -# include "wx/platform.h" -#endif - -#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) - -#ifndef __GSOCKET_STANDALONE__ - -#include "wx/msw/gsockmsw.h" #include "wx/gsocket.h" +#include "wx/apptrait.h" -extern "C" WXDLLIMPEXP_BASE HINSTANCE wxGetInstance(void); +extern "C" WXDLLIMPEXP_BASE HINSTANCE wxGetInstance(); #define INSTANCE wxGetInstance() -#else /* __GSOCKET_STANDALONE__ */ - -#include "gsockmsw.h" -#include "gsocket.h" - -/* If not using wxWidgets, a global var called hInst must - * be available and it must contain the app's instance - * handle. - */ -extern HINSTANCE hInst; -#define INSTANCE hInst - -#endif /* !__GSOCKET_STANDALONE__/__GSOCKET_STANDALONE__ */ - -#ifndef __WXWINCE__ -#include -#else -#define assert(x) +#ifdef __WXWINCE__ #include #include "wx/msw/wince/net.h" #include "wx/hashmap.h" @@ -125,7 +86,7 @@ typedef struct _WSANETWORKEVENTS { long lNetworkEvents; int iErrorCode[10]; } WSANETWORKEVENTS, FAR * LPWSANETWORKEVENTS; -typedef HANDLE (PASCAL *WSACreateEventFunc)(void); +typedef HANDLE (PASCAL *WSACreateEventFunc)(); typedef int (PASCAL *WSAEventSelectFunc)(SOCKET,HANDLE,long); typedef int (PASCAL *WSAWaitForMultipleEventsFunc)(long,HANDLE,BOOL,long,BOOL); typedef int (PASCAL *WSAEnumNetworkEventsFunc)(SOCKET,HANDLE,LPWSANETWORKEVENTS); @@ -210,15 +171,29 @@ DWORD WINAPI SocketThread(LPVOID data) } #endif +// ---------------------------------------------------------------------------- +// MSW implementation of GSocketManager +// ---------------------------------------------------------------------------- -bool GSocketGUIFunctionsTableConcrete::CanUseEventLoop() +class GSocketMSWManager : public GSocketManager { - return true; -} +public: + virtual bool OnInit(); + virtual void OnExit(); + + virtual bool Init_Socket(GSocket *socket); + virtual void Destroy_Socket(GSocket *socket); + + virtual void Install_Callback(GSocket *socket, GSocketEvent event); + virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event); + + virtual void Enable_Events(GSocket *socket); + virtual void Disable_Events(GSocket *socket); +}; /* Global initializers */ -bool GSocketGUIFunctionsTableConcrete::OnInit() +bool GSocketMSWManager::OnInit() { static LPCTSTR pclassname = NULL; int i; @@ -280,7 +255,7 @@ bool GSocketGUIFunctionsTableConcrete::OnInit() return true; } -void GSocketGUIFunctionsTableConcrete::OnExit() +void GSocketMSWManager::OnExit() { #ifdef __WXWINCE__ /* Delete the threads here */ @@ -304,7 +279,7 @@ void GSocketGUIFunctionsTableConcrete::OnExit() /* Per-socket GUI initialization / cleanup */ -bool GSocketGUIFunctionsTableConcrete::Init_Socket(GSocket *socket) +bool GSocketMSWManager::Init_Socket(GSocket *socket) { int i; @@ -331,7 +306,7 @@ bool GSocketGUIFunctionsTableConcrete::Init_Socket(GSocket *socket) return true; } -void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket) +void GSocketMSWManager::Destroy_Socket(GSocket *socket) { /* Remove the socket from the list */ EnterCriticalSection(&critical); @@ -340,6 +315,18 @@ void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket) LeaveCriticalSection(&critical); } +void GSocketMSWManager::Install_Callback(GSocket * WXUNUSED(socket), + GSocketEvent WXUNUSED(event)) +{ + wxFAIL_MSG( _T("not used under MSW") ); +} + +void GSocketMSWManager::Uninstall_Callback(GSocket * WXUNUSED(socket), + GSocketEvent WXUNUSED(event)) +{ + wxFAIL_MSG( _T("not used under MSW") ); +} + /* Windows proc for asynchronous event handling */ LRESULT CALLBACK _GSocket_Internal_WinProc(HWND hWnd, @@ -416,10 +403,8 @@ LRESULT CALLBACK _GSocket_Internal_WinProc(HWND hWnd, * events for internal processing, but we will only notify users * when an appropiate callback function has been installed. */ -void GSocketGUIFunctionsTableConcrete::Enable_Events(GSocket *socket) +void GSocketMSWManager::Enable_Events(GSocket *socket) { - assert (socket != NULL); - if (socket->m_fd != INVALID_SOCKET) { /* We could probably just subscribe to all events regardless @@ -449,10 +434,8 @@ void GSocketGUIFunctionsTableConcrete::Enable_Events(GSocket *socket) /* _GSocket_Disable_Events: * Disable event notifications (when shutdowning the socket) */ -void GSocketGUIFunctionsTableConcrete::Disable_Events(GSocket *socket) +void GSocketMSWManager::Disable_Events(GSocket *socket) { - assert (socket != NULL); - if (socket->m_fd != INVALID_SOCKET) { #ifndef __WXWINCE__ @@ -464,12 +447,17 @@ void GSocketGUIFunctionsTableConcrete::Disable_Events(GSocket *socket) } } -#else /* !wxUSE_SOCKETS */ - -/* - * Translation unit shouldn't be empty, so include this typedef to make the - * compiler (VC++ 6.0, for example) happy - */ -typedef void (*wxDummy)(); +// set the wxBase variable to point to our GSocketManager implementation +// +// see comments in wx/msw/apptbase.h for the explanation of why do we do it +// like this +static struct ManagerSetter +{ + ManagerSetter() + { + static GSocketMSWManager s_manager; + wxAppTraits::SetDefaultSocketManager(&s_manager); + } +} gsm_managerSetter; -#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */ +#endif // wxUSE_SOCKETS diff --git a/src/os2/gsockpm.cpp b/src/os2/gsockpm.cpp index c0281d2ac1..d51227e843 100644 --- a/src/os2/gsockpm.cpp +++ b/src/os2/gsockpm.cpp @@ -31,34 +31,6 @@ static void _GSocket_PM_Output(void *data) socket->Detected_Write(); } -bool GSocketGUIFunctionsTableConcrete::CanUseEventLoop() -{ return true; } - -bool GSocketGUIFunctionsTableConcrete::OnInit(void) -{ - return 1; -} - -void GSocketGUIFunctionsTableConcrete::OnExit(void) -{ -} - -bool GSocketGUIFunctionsTableConcrete::Init_Socket(GSocket *socket) -{ - int *m_id; - socket->m_gui_dependent = (char *)malloc(sizeof(int)*2); - m_id = (int *)(socket->m_gui_dependent); - - m_id[0] = -1; - m_id[1] = -1; - return true; -} - -void GSocketGUIFunctionsTableConcrete::Destroy_Socket(GSocket *socket) -{ - free(socket->m_gui_dependent); -} - void GSocketGUIFunctionsTableConcrete::Install_Callback(GSocket *socket, GSocketEvent event) { int *m_id = (int *)(socket->m_gui_dependent); diff --git a/src/unix/baseunix.cpp b/src/unix/baseunix.cpp index f675818f43..01d4281e9d 100644 --- a/src/unix/baseunix.cpp +++ b/src/unix/baseunix.cpp @@ -33,6 +33,7 @@ #include "wx/apptrait.h" #include "wx/unix/execute.h" #include "wx/evtloop.h" +#include "wx/gsocket.h" #include "wx/unix/private/timer.h" diff --git a/src/unix/epolldispatcher.cpp b/src/unix/epolldispatcher.cpp index 6f36836f0f..cd57f12411 100644 --- a/src/unix/epolldispatcher.cpp +++ b/src/unix/epolldispatcher.cpp @@ -82,7 +82,8 @@ wxEpollDispatcher *wxEpollDispatcher::Create() wxLogSysError(_("Failed to create epoll descriptor")); return NULL; } - + wxLogTrace(wxEpollDispatcher_Trace, + _T("Epoll fd %d created"), epollDescriptor); return new wxEpollDispatcher(epollDescriptor); } @@ -115,6 +116,8 @@ bool wxEpollDispatcher::RegisterFD(int fd, wxFDIOHandler* handler, int flags) return false; } + wxLogTrace(wxEpollDispatcher_Trace, + _T("Added fd %d (handler %p) to epoll %d"), fd, handler, m_epollDescriptor); return true; } @@ -134,6 +137,8 @@ bool wxEpollDispatcher::ModifyFD(int fd, wxFDIOHandler* handler, int flags) return false; } + wxLogTrace(wxEpollDispatcher_Trace, + _T("Modified fd %d (handler: %p) on epoll %d"), fd, handler, m_epollDescriptor); return true; } @@ -148,7 +153,8 @@ bool wxEpollDispatcher::UnregisterFD(int fd) wxLogSysError(_("Failed to unregister descriptor %d from epoll descriptor %d"), fd, m_epollDescriptor); } - + wxLogTrace(wxEpollDispatcher_Trace, + _T("removed fd %d from %d"), fd, m_epollDescriptor); return true; } diff --git a/src/unix/gsocket.cpp b/src/unix/gsocket.cpp index 1c4e899b15..d424f1dad1 100644 --- a/src/unix/gsocket.cpp +++ b/src/unix/gsocket.cpp @@ -21,6 +21,7 @@ #ifndef __GSOCKET_STANDALONE__ #include "wx/defs.h" #include "wx/private/gsocketiohandler.h" +#include "wx/thread.h" // for wxThread::IsMain() used in assert #endif #if defined(__VISAGECPP__) @@ -459,65 +460,17 @@ typedef struct sockaddr wxSockAddr; /* Table of GUI-related functions. We must call them indirectly because * of wxBase and GUI separation: */ -static GSocketGUIFunctionsTable *gs_gui_functions; - -class GSocketGUIFunctionsTableNull: public GSocketGUIFunctionsTable -{ -public: - virtual bool OnInit(); - virtual void OnExit(); - virtual bool CanUseEventLoop(); - virtual bool Init_Socket(GSocket *socket); - virtual void Destroy_Socket(GSocket *socket); - virtual void Install_Callback(GSocket *socket, GSocketEvent event); - virtual void Uninstall_Callback(GSocket *socket, GSocketEvent event); - virtual void Enable_Events(GSocket *socket); - virtual void Disable_Events(GSocket *socket); -}; - -bool GSocketGUIFunctionsTableNull::OnInit() -{ return true; } -void GSocketGUIFunctionsTableNull::OnExit() -{} -bool GSocketGUIFunctionsTableNull::CanUseEventLoop() -{ return false; } -bool GSocketGUIFunctionsTableNull::Init_Socket(GSocket *WXUNUSED(socket)) -{ return true; } -void GSocketGUIFunctionsTableNull::Destroy_Socket(GSocket *WXUNUSED(socket)) -{} -void GSocketGUIFunctionsTableNull::Install_Callback(GSocket *WXUNUSED(socket), GSocketEvent WXUNUSED(event)) -{} -void GSocketGUIFunctionsTableNull::Uninstall_Callback(GSocket *WXUNUSED(socket), GSocketEvent WXUNUSED(event)) -{} -void GSocketGUIFunctionsTableNull::Enable_Events(GSocket *WXUNUSED(socket)) -{} -void GSocketGUIFunctionsTableNull::Disable_Events(GSocket *WXUNUSED(socket)) -{} -/* Global initialisers */ - -void GSocket_SetGUIFunctions(GSocketGUIFunctionsTable *guifunc) +bool GSocket_Init() { - gs_gui_functions = guifunc; + GSocketManager * const manager = GSocketManager::Get(); + return manager && manager->OnInit(); } -int GSocket_Init(void) +void GSocket_Cleanup() { - if (!gs_gui_functions) - { - static GSocketGUIFunctionsTableNull table; - gs_gui_functions = &table; - } - if ( !gs_gui_functions->OnInit() ) - return 0; - return 1; -} - -void GSocket_Cleanup(void) -{ - if (gs_gui_functions) - { - gs_gui_functions->OnExit(); - } + GSocketManager * const manager = GSocketManager::Get(); + if ( manager ) + manager->OnExit(); } /* Constructors / Destructors for GSocket */ @@ -547,17 +500,17 @@ GSocket::GSocket() m_timeout = 10*60*1000; /* 10 minutes * 60 sec * 1000 millisec */ m_establishing = false; + m_use_events = false; m_initialRecvBufferSize = -1; m_initialSendBufferSize = -1; - assert(gs_gui_functions); - /* Per-socket GUI-specific initialization */ - m_ok = gs_gui_functions->Init_Socket(this); + m_ok = GSocketManager::Get()->Init_Socket(this); } void GSocket::Close() { - gs_gui_functions->Disable_Events(this); + if (m_use_events) + DisableEvents(); /* When running on OS X, the gsockosx implementation of GSocketGUIFunctionsTable will close the socket during Disable_Events. However, it will only do this @@ -580,8 +533,7 @@ GSocket::~GSocket() if (m_fd != INVALID_SOCKET) Shutdown(); - /* Per-socket GUI-specific cleanup */ - gs_gui_functions->Destroy_Socket(this); + GSocketManager::Get()->Destroy_Socket(this); delete m_handler; @@ -591,6 +543,7 @@ GSocket::~GSocket() if (m_peer) GAddress_destroy(m_peer); + } /* GSocket_Shutdown: @@ -604,7 +557,8 @@ void GSocket::Shutdown() assert(this); /* Don't allow events to fire after socket has been closed */ - gs_gui_functions->Disable_Events(this); + if (m_use_events) + DisableEvents(); /* If socket has been created, shutdown it */ if (m_fd != INVALID_SOCKET) @@ -788,7 +742,8 @@ GSocketError GSocket::SetServer() #endif ioctl(m_fd, FIONBIO, &arg); - gs_gui_functions->Enable_Events(this); + if (m_use_events) + EnableEvents(); /* allow a socket to re-bind if the socket is in the TIME_WAIT state after being previously closed. @@ -907,11 +862,30 @@ GSocket *GSocket::WaitConnection() #else ioctl(connection->m_fd, FIONBIO, &arg); #endif - gs_gui_functions->Enable_Events(connection); + if (m_use_events) + connection->Notify(true); return connection; } +void GSocket::Notify(bool flag) +{ + if (flag == m_use_events) + return; + // it is not safe to attach or detach i/o descriptor in child thread + wxASSERT_MSG( wxThread::IsMain(), "should be called in main thread only" ); + m_use_events = flag; + EnableEvents(flag); +} + +void GSocket::EnableEvents(bool flag) +{ + if (flag) + GSocketManager::Get()->Enable_Events(this); + else + GSocketManager::Get()->Disable_Events(this); +} + bool GSocket::SetReusable() { /* socket must not be null, and must not be in use/already bound */ @@ -1049,8 +1023,8 @@ GSocketError GSocket::Connect(GSocketStream stream) * call to Enable_Events now. */ - if (m_non_blocking || ret == 0) - gs_gui_functions->Enable_Events(this); + if (m_use_events && (m_non_blocking || ret == 0)) + EnableEvents(); if (ret == -1) { @@ -1075,8 +1049,8 @@ GSocketError GSocket::Connect(GSocketStream stream) SOCKOPTLEN_T len = sizeof(error); getsockopt(m_fd, SOL_SOCKET, SO_ERROR, (char*) &error, &len); - - gs_gui_functions->Enable_Events(this); + if (m_use_events) + EnableEvents(); if (!error) return GSOCK_NOERROR; @@ -1156,7 +1130,8 @@ GSocketError GSocket::SetNonOriented() #else ioctl(m_fd, FIONBIO, &arg); #endif - gs_gui_functions->Enable_Events(this); + if (m_use_events) + EnableEvents(); if (m_reusable) { @@ -1228,9 +1203,12 @@ int GSocket::Read(char *buffer, int size) if (ret == 0) { /* Make sure wxSOCKET_LOST event gets sent and shut down the socket */ - m_detected = GSOCK_LOST_FLAG; - Detected_Read(); - return 0; + if (m_use_events) + { + m_detected = GSOCK_LOST_FLAG; + Detected_Read(); + return 0; + } } else if (ret == -1) { @@ -1314,116 +1292,9 @@ int GSocket::Write(const char *buffer, int size) */ GSocketEventFlags GSocket::Select(GSocketEventFlags flags) { - if (!gs_gui_functions->CanUseEventLoop()) - { - - GSocketEventFlags result = 0; - fd_set readfds; - fd_set writefds; - fd_set exceptfds; - struct timeval tv; - - assert(this); - - if (m_fd == -1) - return (GSOCK_LOST_FLAG & flags); - - /* Do not use a static struct, Linux can garble it */ - tv.tv_sec = m_timeout / 1000; - tv.tv_usec = (m_timeout % 1000) * 1000; - - wxFD_ZERO(&readfds); - wxFD_ZERO(&writefds); - wxFD_ZERO(&exceptfds); - wxFD_SET(m_fd, &readfds); - if (flags & GSOCK_OUTPUT_FLAG || flags & GSOCK_CONNECTION_FLAG) - wxFD_SET(m_fd, &writefds); - wxFD_SET(m_fd, &exceptfds); - - /* Check 'sticky' CONNECTION flag first */ - result |= (GSOCK_CONNECTION_FLAG & m_detected); - - /* If we have already detected a LOST event, then don't try - * to do any further processing. - */ - if ((m_detected & GSOCK_LOST_FLAG) != 0) - { - m_establishing = false; - - return (GSOCK_LOST_FLAG & flags); - } - - /* Try select now */ - if (select(m_fd + 1, &readfds, &writefds, &exceptfds, &tv) <= 0) - { - /* What to do here? */ - return (result & flags); - } - - /* Check for exceptions and errors */ - if (wxFD_ISSET(m_fd, &exceptfds)) - { - m_establishing = false; - m_detected = GSOCK_LOST_FLAG; - - /* LOST event: Abort any further processing */ - return (GSOCK_LOST_FLAG & flags); - } - - /* Check for readability */ - if (wxFD_ISSET(m_fd, &readfds)) - { - result |= GSOCK_INPUT_FLAG; - - if (m_server && m_stream) - { - /* This is a TCP server socket that detected a connection. - While the INPUT_FLAG is also set, it doesn't matter on - this kind of sockets, as we can only Accept() from them. */ - result |= GSOCK_CONNECTION_FLAG; - m_detected |= GSOCK_CONNECTION_FLAG; - } - } - - /* Check for writability */ - if (wxFD_ISSET(m_fd, &writefds)) - { - if (m_establishing && !m_server) - { - int error; - SOCKOPTLEN_T len = sizeof(error); - - m_establishing = false; - - getsockopt(m_fd, SOL_SOCKET, SO_ERROR, (char*)&error, &len); - - if (error) - { - m_detected = GSOCK_LOST_FLAG; - - /* LOST event: Abort any further processing */ - return (GSOCK_LOST_FLAG & flags); - } - else - { - result |= GSOCK_CONNECTION_FLAG; - m_detected |= GSOCK_CONNECTION_FLAG; - } - } - else - { - result |= GSOCK_OUTPUT_FLAG; - } - } - - return (result & flags); + assert(this); - } - else - { - assert(this); - return flags & m_detected; - } + return flags & m_detected; } /* Flags */ @@ -1558,14 +1429,20 @@ GSocketError GSocket::SetSockOpt(int level, int optname, void GSocket::Enable(GSocketEvent event) { - m_detected &= ~(1 << event); - gs_gui_functions->Install_Callback(this, event); + if (m_use_events) + { + m_detected &= ~(1 << event); + GSocketManager::Get()->Install_Callback(this, event); + } } void GSocket::Disable(GSocketEvent event) { - m_detected |= (1 << event); - gs_gui_functions->Uninstall_Callback(this, event); + if (m_use_events) + { + m_detected |= (1 << event); + GSocketManager::Get()->Uninstall_Callback(this, event); + } } /* _GSocket_Input_Timeout: diff --git a/wxGTK.spec b/wxGTK.spec index c50860c79b..b9945f5cfc 100644 --- a/wxGTK.spec +++ b/wxGTK.spec @@ -329,6 +329,7 @@ wx/xtistrm.h wx/zipstrm.h wx/zstream.h wx/private/fdiodispatcher.h +wx/private/gsocketiohandler.h wx/private/selectdispatcher.h wx/unix/app.h wx/unix/apptbase.h diff --git a/wxMotif.spec b/wxMotif.spec index 4887f78729..232f58c139 100644 --- a/wxMotif.spec +++ b/wxMotif.spec @@ -234,6 +234,7 @@ wx/xtistrm.h wx/zipstrm.h wx/zstream.h wx/private/fdiodispatcher.h +wx/private/gsocketiohandler.h wx/private/selectdispatcher.h wx/unix/app.h wx/unix/apptbase.h diff --git a/wxX11.spec b/wxX11.spec index c4e090b543..94eba4e03d 100644 --- a/wxX11.spec +++ b/wxX11.spec @@ -258,6 +258,7 @@ wx/xtistrm.h wx/zipstrm.h wx/zstream.h wx/private/fdiodispatcher.h +wx/private/gsocketiohandler.h wx/private/selectdispatcher.h wx/unix/app.h wx/unix/apptbase.h -- 2.45.2