Re: programming practices with regard to gtk and networking



Hi Ken,

Ken Nagorski wrote:
Hi there,

I just started working with GTK. I have a some background with C which
means I can do OK but when it comes to working with the two together
it gets harder...

My question is really this. I have a very simple IM program that I
wrote in java (had to take a class on it) and I started porting the
application to C and GTK but here is where I run into a problem. I
have a button that says connect. and when clicked it creates the
connection all that works fine, however unlike calling a normal
function I can't really pass data back from the function the button
called. Can I... What I need to do is somehow create the connection
when the button is clicked and then pass the
sockfd to the calling part of the programming (main) so I can then use
that in the calls to send().

What I really need is someone to point me in the right direction.
When you connect an event handler to a signal, you can pass a user_data
parameter. If you design you app in oo-style then you can pass a
reference of e.g. you application-objsct as user_data. When the event
triggers the handler will receive this reference and can access you
applications methods and members.


Thanks alot
Ken

Stefan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]