Re: socket and gtk problem, help!



Check out Gnet too:
	http://www.eecs.umich.edu/~dhelder/misc/gnet

Look at the echoserver example - it will show you what you need to do to
make an asynchronous server with Glib/Gnet.

David


On Wed, 2 Aug 2000 huangjnb@legend.com.cn wrote:

> Hi,all, I am writing a server program which listen and process client's 
> request from other computer on LAN. I build server's GUI with gtk and 
> wrote a piece of code to listen socket request as follow: 
> 
> .... 
> BuildGUI(); 
> 
> do{ 
> int newsockd=accept(sockd,(struct sockaddr *)&client_addr,&sin_size); 
> if£¨newsockd!=-1£© 
>   DoSomething(); 
> else 
>   continue; 
> }while(1); 
> .... 
> 
> there, gtk_main(); was put in BuildGUI. The program suspend when it goes 
> to gtk_main(), so the do-while loop does not take effect .I know that 
> gtk_main() raise a message loop and do-while is another loop . How can I 
> make them work together? MultiThread program maybe a way to go and I tried 
> but failed when i put some gtk-about code in DoSomething(). How should I 
> do then? 
> 
> Help me ,thanks! 
> 

-- 
      __          _    __  David Helder - University of Michigan
  ___/ /__ __  __(_)__/ /  dhelder@umich.edu
 / _  / _ `/ |/ / / _  /   http://www.eecs.umich.edu/~dhelder
 |_,_/|_,_/|___/_/|_,_/    Jungle Monkey: http://www.junglemonkey.net





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