GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

regarding neat

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
ramesh
GTK+ Geek


Joined: 16 Nov 2006
Posts: 68

PostPosted: Tue Jan 02, 2007 12:35 pm    Post subject: regarding neat Reply with quote

hi everyone
happy new year to all
i got a problem
terminal->neat

it will open Network Configuration window

in this 2 buttons Activate and Deactivate are there

how can i use these buttons in my program

am doing the same example
am taking two buttons named as same
how can i do activate and deactivate operations without using neat

where these signals stores in my system F4

i hope you can understand my problem
please show me the way

thank you in advance
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 480
Location: Portland, OR USA

PostPosted: Tue Jan 02, 2007 7:18 pm    Post subject: Reply with quote

I'm sorry, I don't understand...
Back to top
ramesh
GTK+ Geek


Joined: 16 Nov 2006
Posts: 68

PostPosted: Wed Jan 03, 2007 5:01 am    Post subject: thank you Reply with quote

how can i know wether the net is activated or deactivated in programatically

thank you
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 480
Location: Portland, OR USA

PostPosted: Wed Jan 03, 2007 5:34 am    Post subject: Reply with quote

Well, I'm not really sure. Perhaps you can use SMB or something... either the net_lookup or parse the output of the "net lookup" command? It'll return -1 if it can't resolve the host and 0 if it succeeds.

I'll play around with it later... but now I'm off to the movies.

[/code]
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 480
Location: Portland, OR USA

PostPosted: Wed Jan 03, 2007 8:04 am    Post subject: Reply with quote

Try this:

Code: (Plaintext)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>

int can_resolve_host (const char *host)
{
    struct hostent *h = NULL;
    h = gethostbyname (host);
   
    if (h == NULL)
    {
           return -1;
    }
    else
    {
        return 0;
    }
}

int main(int argc, char **argv)
{
    if (can_resolve_host ("google.com") == -1)
    {
        printf ("Failed to reach google.com\n");
    }
    else
    {
        printf ("Successfully reached google.com\n");   
    }
   
    return 0;
}
Back to top
ramesh
GTK+ Geek


Joined: 16 Nov 2006
Posts: 68

PostPosted: Wed Jan 03, 2007 10:03 am    Post subject: thank you Reply with quote

its amazing.
thank you Micah Carrick
.
Back to top
Micah Carrick
Never Seen the Sunlight


Joined: 21 Sep 2005
Posts: 480
Location: Portland, OR USA

PostPosted: Wed Jan 03, 2007 6:17 pm    Post subject: Reply with quote

Sure. More details about the struct that does return (list of IPs, etc) can be found by typing 'man gethostname'
Back to top
denore



Joined: 20 Feb 2007
Posts: 2

PostPosted: Tue Feb 20, 2007 1:22 pm    Post subject: hi Reply with quote

yeam using this code.

it is very usefull.

when i remove the cable the code not working

can u please advise me

thank you
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP