Luigi Auriemma

aluigi.org (ARCHIVE-ONLY FORUM!)
It is currently 19 Jul 2012 14:43

All times are UTC [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: c sockets
PostPosted: 04 Nov 2008 20:44 

Joined: 04 Nov 2008 20:41
Posts: 2
Hey ,
I want to write a socket program which awaits a connection to receive for processing. Do I have to put accept in an infinite loop ? can you give me a simple example . I'm on Linux please include Linux header files if its possible for you.

thanks in advance


Top
 Profile  
 
 
 Post subject: Re: c sockets
PostPosted: 04 Nov 2008 21:26 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
the attached code is a perfect example.
As you can see I have used the threads because there is nothing better for handling multiple connections easily.

In case you don't want to use threads you can simply subsituite "if(!quick_threadx(client, (void *)sda)) close(sda);" with "client(sda);" and removing any other reference to *thread*s.


Attachments:
listenme.c [2.31 KiB]
Downloaded 94 times
Top
 Profile  
 
 Post subject: Re: c sockets
PostPosted: 05 Nov 2008 06:49 

Joined: 04 Nov 2008 20:41
Posts: 2
Much Appreciated !


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for: