[so] [Tema4] Operatii asincrone
cosminratiu at gmail.com
cosminratiu at gmail.com
Mon Dec 10 20:31:14 EET 2007
Mai simplu este cu ioctl cu FIONBIO, asa cum e in laborator.
//puts a socket in nonblocking mode
void set_nonblocking(int s)
{
int m = 1;
ioctl(s, FIONBIO, &m);
}
On Dec 10, 2007 7:19 PM, Dragos Sbarlea <sbarlead at yahoo.com> wrote:
> Ca sa fim chitibusari (sau iubitori de corectitudine) ar trebui mai intai
> sa luam flagurile curente (F_GETFL) pentru socket si apoi sa adaugam flagul
> O_NONBLOCK. :)
>
> Cum celelalte flaguri nu prea se pot folosi la socketi cred ca e ok si
> asa, dar cine stie...
>
> Dragos Dumitru Sbîrlea
> Facultatea de Automatica si Calculatoare
> Universitatea Politehnica din Bucuresti
>
> ----- Original Message ----
> From: Iulian Moraru <iulian at gmail.com>
> To: Sisteme de Operare <so at cursuri.cs.pub.ro>
> Sent: Monday, 10 December, 2007 2:00:58 PM
> Subject: Re: [so] [Tema4] Operatii asincrone
>
> On Dec 10, 2007 1:40 PM, Alexandru-Mihai Carp <carpalex at gmail.com> wrote:
> > Lucian Adrian Grijincu wrote:
> > >
> > > Pentru socketi trebuie folosite operatii non-blocante.
> > >
> > >
> > Pai read / write sau recv / send sunt blocante, daca nu stim cat avem de
> > trimis / primit.
> > Singura modalitatate de a fi non-blocante e sa ne asiguram ca nu citim
> > mai mult decat ni s-a trimis, nu?
>
> Faci ca socketul sa fie non-blocant cu fcntl, comanda F_SETFL si
> flagul O_NONBLOCK. Pe urma read, write, send si recv se vor comporta
> diferit (cauta EAGAIN in paginile lor de manual).
>
> Iulian
>
>
>
> > _______________________________________________
> > so mailing list
> > so at cursuri.cs.pub.ro
> > http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so
> >
> _______________________________________________
> so mailing list
> so at cursuri.cs.pub.ro
> http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so
>
>
> ------------------------------
> Support the World Aids Awareness campaign this month with Yahoo! for Good<http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=51947/*http://uk.promotions.yahoo.com/forgood/>
>
> _______________________________________________
> so mailing list
> so at cursuri.cs.pub.ro
> http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cursuri.cs.pub.ro/pipermail/so/attachments/20071210/13105062/attachment.htm
More information about the so
mailing list