|
Luigi Auriemmaaluigi.org (ARCHIVE-ONLY FORUM!) |
|
It is currently 19 Jul 2012 19:12
|
View unanswered posts | View active topics
|
Page 1 of 1
|
[ 3 posts ] |
|
Author |
Message |
pedramasl
|
Post subject: c sockets Posted: 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 |
|
|
aluigi
|
Post subject: Re: c sockets Posted: 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 |
|
|
pedramasl
|
Post subject: Re: c sockets Posted: 05 Nov 2008 06:49 |
|
Joined: 04 Nov 2008 20:41 Posts: 2
|
|
Top |
|
|
|
Page 1 of 1
|
[ 3 posts ] |
|
|
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
|
|