Re: lug-bg: socket programming
- Subject: Re: lug-bg: socket programming
- From: vd@xxxxxxxxx (Vladimir Dzhuvinov)
- Date: Mon, 28 May 2001 19:34:04 +0000 (GMT)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Zdravei,
>interesno... sys sockopt se oprawi :)
Prochetah predishnite ti syobstenia. Moga samo da kawa, che uwasno mnogo
se obyrkah, veche dori ne sym siguren kakyv beshe problema ;-)
No taka kakto si go reshil sys setsockopt ne mi se struva pravilno.
Pod terminala niamah predvid takyv zakachen za socket, a tozi na koito
pishesh s tvoita klaviatura - dokolkoto si spomniam oste ;-) nali v
nachaloto pisa, che ne se transmitvat chars predi da si natisnal enter?
Tam izbroi nikakvi funkcii, kato lineread i getc, ala vsystnost za da
emulirash telnetski input se polzva read. Predi tova obache triabva da
setnesh tvoia terminal v non - canonical mode, zastoto, i ti go znaesh,
stdin e line buffered po default. Tova stava s tcsetattr(STDIN_FILENO,
...), i syotvetnite macros, sled tova vlizash v loop i chetesh ot
terminala po char s read() do kato (...); vednaga sled kato poluchish
char, go prastash po socket. Tuk veche ako iskash polzvai fd i write, ili
go stori na buffered stream i sled tova sys fflush go chisti.
Sto se otnasia do "izprastastata strana", tochno neia imah predvid, zavisi
obache ot koi krai na mrewata i na socketa gledash nestata ;-)
Triabvashe mai da kawa serverside, ama ne se setih za tazi duma...
Socketa si ima bufer, no toi e ot stranata ne kernel, zatova setvbuf niama
efekt, i zatova kazah, che socket e unbuffered ot strana na tvoiata user
space programa. socket() vrysta filedes, a ne FILE* stream.
uf! haide s pozdravi ;-)
Vladimir
- --
PGP 1024D/959FC3BC 2001-02-12 Vladimir Dzhuvinov <vd@xxxxxxxxx>
Key fingerprint = CB20 FC83 775C C34E 49D5 0F71 BAE5 7C38 959F C3BC
Download public PGP key from http://www.valan.net/vdzhuvinov.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE7EqgyuuV8OJWfw7wRAm2QAJ9PgkDjf0LaL4cWvUNADUAwwQimpgCgxOFX
pE8Qcq/TJgVHTsf37oBfxR8=
=zNod
-----END PGP SIGNATURE-----
===========================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
http://www.linux-bulgaria.org/ Hosted by Internet Group Ltd. - Stara Zagora
|