Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7865573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:07:49+00:00 2026-06-03T00:07:49+00:00

this is a general question about GUIs. I never wrote a program with GUI,

  • 0

this is a general question about GUIs. I never wrote a program with GUI, and now I have to do it for the University. I found that the best solution programming in C is GTK+.

I see many examples, but I still can’t understand one thing. My program is a server/client app, so it has to run in background also if there’s a small GUI. How could it be realised? I see that to “start” the guy I have to use gtk_main() loop, and the application blocks inside this loop for all the time. Should I use fork() to do other tasks at the same time?

Thanks, sorry if it’s a trivial question.


It’s difficult to explain it in italian, in english is even worst 🙂

The program has to listen continously the network (LAN), to see if other users arrives and catch their UDP messages, and at the same time it has to communicate to a specific user if some conditions are verified (for example, if a file in a local folder changes, it has to send this file to the designated user. This could happen with multiple users at the same time). I have only one application that has to be server (sending files) and client (listening to the network) at the same time.

The idea of having a separate “client” which implements the GUI could be interesting.

I never developed a GUI, so I thought to write all my program, and then add the GUI at the end. It’s possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T00:07:50+00:00Added an answer on June 3, 2026 at 12:07 am

    You would run other tasks by asking the main loop to run them for you. This is handled automatically if you do IO with GIO (see http://developer.gnome.org/gio/stable/). But in the general case you would use functions such as g_idle_add(), g_timeout_add(), etc. as described here: http://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html and perhaps g_io_add_watch() here: http://developer.gnome.org/glib/stable/glib-IO-Channels.html

    If you need to do blocking IO (something like read()/fread() calls) then you have to spawn a thread and have that thread communicate back to the GUI loop by adding an idle handler. This is tricky to understand if you’re new to main loops or threads, so using GIO is a superior option since it does this for you.

    You can also use fork() to spawn a process to do your IO, but then you need to use IO to communicate with your process, so you can’t really avoid having to do IO in the UI process.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a general question about writing web apps. I have an application that
this is a General Question about MVC .. I wrote a PHP Class that
This is a general design question about how to make a web application that
I have a general question about this. When you have a gallery, sometimes people
I have a general question about Hibernate that I'm batteling with. I have class
This is a general question about design. What's the best way to communicate between
This is a general best practice question about creating parent / child relationships with
Yesterday I asked this general question about decimals and their internal precisions. Here is
This is a general question about MVC as a pattern, but in this case
This is a general question about character encoding when using MD5 libraries in various

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.