* non-blocking server?
@ 2003-01-17 22:31 Wrazlov
2003-01-17 22:38 ` SUBREDU Manuel
2003-01-18 11:34 ` Elias Athanasopoulos
0 siblings, 2 replies; 3+ messages in thread
From: Wrazlov @ 2003-01-17 22:31 UTC (permalink / raw)
To: linux-c-programming
Hello,
the last time I tried to write a server in C I had the problem that it had to
wait for Bytes to arrive at the open port which blocked the process.
A solution would be, of course, threading of the server-process or using
signals, but I want this code to be used in a windows-environment, too.
Is that possible? Does the standard-c-library provide some kind of signals or
thread-programming for all systems?
wrazlov
--
"What do you get if you multiply six by nine?"
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: non-blocking server?
2003-01-17 22:31 non-blocking server? Wrazlov
@ 2003-01-17 22:38 ` SUBREDU Manuel
2003-01-18 11:34 ` Elias Athanasopoulos
1 sibling, 0 replies; 3+ messages in thread
From: SUBREDU Manuel @ 2003-01-17 22:38 UTC (permalink / raw)
To: Wrazlov; +Cc: linux-c-programming
Hy,
a more practical solution is to use the select() function, who help's you
write a server in C who can serve multiple clients at once but does not require
any thread programming. And, as far as I know it's also supported by M$ C
compiler and linker.
On Fri, 17 Jan 2003, Wrazlov wrote:
> Hello,
> the last time I tried to write a server in C I had the problem that it had to
> wait for Bytes to arrive at the open port which blocked the process.
> A solution would be, of course, threading of the server-process or using
> signals, but I want this code to be used in a windows-environment, too.
> Is that possible? Does the standard-c-library provide some kind of signals or
> thread-programming for all systems?
>
> wrazlov
> --
> "What do you get if you multiply six by nine?"
> -
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: non-blocking server?
2003-01-17 22:31 non-blocking server? Wrazlov
2003-01-17 22:38 ` SUBREDU Manuel
@ 2003-01-18 11:34 ` Elias Athanasopoulos
1 sibling, 0 replies; 3+ messages in thread
From: Elias Athanasopoulos @ 2003-01-18 11:34 UTC (permalink / raw)
To: Wrazlov; +Cc: linux-c-programming
On Fri, Jan 17, 2003 at 10:31:31PM +0000, Wrazlov wrote:
> the last time I tried to write a server in C I had the problem that it had to
> wait for Bytes to arrive at the open port which blocked the process.
You can make the socket non-blocking:
fcntl(s, F_SETFL, O_NONBLOCK);
Use select() to pick the right descriptor to send()/recv() data.
Elias
--
http://gnewtellium.sourceforge.net MP3 is not a crime.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-01-18 11:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-17 22:31 non-blocking server? Wrazlov
2003-01-17 22:38 ` SUBREDU Manuel
2003-01-18 11:34 ` Elias Athanasopoulos
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).