Console Daemon App

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
kotoroshinoto
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Mar 11, 2010 11:09 pm
Location: West Hartford
Contact:

Console Daemon App

Post by kotoroshinoto » Sat Mar 13, 2010 8:53 am

I'm not sure I'm up to the challenge, but I'm trying to figure out how to write a cross platform server daemon (in the sense that you can compile it on any platform). It would need to use sockets and thus it needs to use wxWidget's ability to set up the OS-dependent Main loop, BUT I don't want it to run any GUI windows.

Incidentally I would like to write a second app once the daemon part is at a minimal point of setup that acts as an administrator client, which WOULD have a GUI interface. I will probably achieve this by having special users that are acknowledge as admins and can send settings to the server.

There should probably be a way to start/stop the program similar to a system service, but thats a secondary concern until the rest is working.

The hope is to eventually develop a MUD server, but I'd like to the get the SERVER part of the thing programmed and working first before I go any farther into worrying about the MUD functionality.

I'm having trouble figuring out what I need to implement and which Macros to use to set up such a thing. For one thing I know I need sockets, but do I need to make a class that extends wxApp or is there a better class to extend?

Oh and I should add that, if anybody knows how to make sure that only one instance of this program should be able to run, I'd appreciate a tutorial in doing that.

TrV
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 630
Joined: Wed Jul 04, 2007 1:12 pm

Post by TrV » Sat Mar 13, 2010 9:37 am

- Console application: i've this link but never really used it:
http://forums.wxwidgets.org/viewtopic.php?t=1173

- Single instance management: this should do it
http://forums.wxwidgets.org/viewtopic.p ... 038#116038

You can also make a search in this forum about what you are looking for.

User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2293
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Post by evstevemd » Sat Mar 13, 2010 9:44 am

Yes, you can do that :D
use wxSocket.

http://wiki.wxwidgets.org/WxSocket

http://old.nabble.com/wxSockets-console ... 90922.html

Don't forget to check documentation for wxSocket
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 19.04/Windows 10 Pro/MacOS 10.13 - GCC/MinGW/Clang, CodeLite IDE]

eranif
Moderator
Moderator
Posts: 607
Joined: Tue Nov 29, 2005 7:10 pm
Location: Israel

Post by eranif » Sat Mar 13, 2010 10:10 am

If you only require daemon, I would suggest you NOT to use wxWidgets.
The main reason is that the wxWidgets code requires an X server up and running (i.e. you can NOT run/debug it from ssh for example), you will always need to have X server.

Eran
IDE: CodeLite + wxCrafter
OS: All
https://wxcrafter.codelite.org
https://codelite.org

TrV
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 630
Joined: Wed Jul 04, 2007 1:12 pm

Post by TrV » Sat Mar 13, 2010 10:55 am

The question has already been discussed, and wxWidgets is not aimed for that kind of purpose (even if it's still possible).
This is one of the attended features of the v3.

User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2293
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Post by evstevemd » Sat Mar 13, 2010 11:28 am

TrV wrote:The question has already been discussed, and wxWidgets is not aimed for that kind of purpose (even if it's still possible).
This is one of the attended features of the v3.
what do you mean. I don't get you :roll:
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 19.04/Windows 10 Pro/MacOS 10.13 - GCC/MinGW/Clang, CodeLite IDE]

kotoroshinoto
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Mar 11, 2010 11:09 pm
Location: West Hartford
Contact:

Post by kotoroshinoto » Sat Mar 13, 2010 11:56 am

Does anybody know of a library that provides cross platform OS event handling that isn't directed at GUI (thus not requiring X11)

Are you sure X11 is required? Might I be able to hack something together using wxBase?

btw I've gotten it as far as accepting incoming connections, but then the server shuts off.
Last edited by kotoroshinoto on Sat Mar 13, 2010 12:14 pm, edited 1 time in total.

catalin
Moderator
Moderator
Posts: 1594
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Post by catalin » Sat Mar 13, 2010 12:04 pm

kotoroshinoto wrote:Does anybody know of a library that provides cross platform OS event handling that isn't directed at GUI (thus not requiring X11)

Are you sure X11 is required? Might I be able to hack something together using wxBase?
Use wxW 2.9.x.
changes.txt: "Event loops, timers and sockets can now be used in wxBase, without GUI."

TrV
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 630
Joined: Wed Jul 04, 2007 1:12 pm

Post by TrV » Sat Mar 13, 2010 12:12 pm

evstevemd wrote:
TrV wrote:The question has already been discussed, and wxWidgets is not aimed for that kind of purpose (even if it's still possible).
This is one of the attended features of the v3.
what do you mean. I don't get you :roll:
wxWidgets is GUI-oriented, so console application and server/daemon are not what it is really good at.

User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2293
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Post by evstevemd » Sat Mar 13, 2010 12:15 pm

So you mean in V3 it will be good at that also?
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 19.04/Windows 10 Pro/MacOS 10.13 - GCC/MinGW/Clang, CodeLite IDE]

kotoroshinoto
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Mar 11, 2010 11:09 pm
Location: West Hartford
Contact:

Post by kotoroshinoto » Sat Mar 13, 2010 12:19 pm

Do I have to use any special build parameters to get wxBase?

TrV
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 630
Joined: Wed Jul 04, 2007 1:12 pm

Post by TrV » Sat Mar 13, 2010 12:20 pm

evstevemd wrote:So you mean in V3 it will be good at that also?
That's one says about v3 for at least console application.
I'm not imply in wxWidgets development, so i can just relay what others say.

Catalin has reminded that v2.9 is already able to do that.
I know this may sound stupid, but as it's still marked as not stable i wouldn't recommend it (it's just my opinion).

About services/daemons, i don't know.
Last edited by TrV on Sat Mar 13, 2010 3:09 pm, edited 1 time in total.

User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2293
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania
Contact:

Post by evstevemd » Sat Mar 13, 2010 12:31 pm

kotoroshinoto wrote:Do I have to use any special build parameters to get wxBase?
http://wiki.wxwidgets.org/Guides_%26_Tutorials
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
[Ubuntu 19.04/Windows 10 Pro/MacOS 10.13 - GCC/MinGW/Clang, CodeLite IDE]

kotoroshinoto
Earned a small fee
Earned a small fee
Posts: 11
Joined: Thu Mar 11, 2010 11:09 pm
Location: West Hartford
Contact:

Post by kotoroshinoto » Sat Mar 13, 2010 1:25 pm

TrV wrote:
evstevemd wrote:So you mean in V3 it will be good at that also?
That's one say about v3 for at least console application.
I'm not imply in wxWidgets development, so i can just relay what others say.

Catalin has reminded that v2.9 is already able to do that.
I know this may sound stupid, but as it's still marked as not stable i wouldn't recommend it (it's just my opinion).

About services/daemons, i don't know.
I'm fine with using another library if a good one exists.

I'm not really doing this for deployment yet, I'm trying to get a feel for the types of things involved in making this sort of program and when its sufficiently developed I would then consider what would be best to do for stability.

Still can't get the program to stay on, I think the lack of a frame is pissing it off.

Does anybody know what I have to change in order to utilize the wxBase library? I checked in the lib folder and the library did build. Do I replace a linker library from msw to base?

Post Reply