Re: lug-bg: socket programming
- Subject: Re: lug-bg: socket programming
- From: firedust@xxxxxxx (Stanislav Lechev)
- Date: Tue, 29 May 2001 14:33:42 +0300
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Monday 28 May 2001 22:34, you wrote:
> -----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
[.....]
ega weche te razbrah
i moga da kava samo edno ...
absolyutno si praw :))
10x
no segla sledwa sledwashtiq wypros...
znachi kato kazah che se oprawi
se okazwa che se oprawi ama na 50% :)
t.e. sega kato pisha char na clientside
toj idwa na serverside
no nemoga da go polzwam dokato ne natisna enter :)
demek se taq :)
ta i az wchera stignah do twoqta teoriq
za terminala (koqto edwa sega razbrah)
no tyj kato nemoga da polzwam termios funkciite w socket-a si
poneve nqmam izgraden terminal reshih da pribegna do malyk
trik
ta znachi ako otworite s netcat edno cisco
ili prosto telnet ili kakwoti i da e (samo da ima terminal)
shte widite pyrwite 5-10 chars koito sa init za terminala
towa telnet-a ne go pokazwa
az izpolzwah 2 mashini za primer
cisco router
3com hiper arc
getnah im init chars na terminala i eto kakwo poluchih:
tatic unsigned char 3com_terminit[] = {
// --- 3com --------
0xff, 0xfd, 0x03,
0xff, 0xfb, 0x03,
0xff, 0xfb, 0x01,
// -----------------
}
static unsigned char cisco_terminit[] = {
// --- cisco -------
0xff, 0xfb, 0x01,
0xff, 0xfb, 0x03,
0xff, 0xfd, 0x18,
0xff, 0xfd, 0x1f,
// -----------------
};
towa sa init chars za terminala...
sled malko naglasqne poluchih sledniq string kojto mi swyrshi
rabota:
static unsigned char my_terminit[] = {
// --- cisco -------
0xff, 0xfb, 0x01,
0xff, 0xfb, 0x03,
// -----------------
};
sega na wyprosa :)
seshtate li se za nqkoq funkciq s koqto moga po
choweshki nachin da si pratq terminit-a
za da ne mi se nalaga da prashtam towa chudo pri
otwarqne na connection-a
??????
a ... i iskam da blagodarq na vladimir...
za syvalenie malko kysno te razbrah no opredeleno
beshe w prawilnata posoka :)
- --
- -===============================================================-
- - Regards, AngelFire -
- - Stanislav Lechev <firedust@xxxxxxx> -
- - PGP Key: http://firedust.vega.bg/pgp/StanislavLechev.asc -
- - Vega Internet Service Provider (tm) -- http://www.vega.bg -
- -===============================================================-
Everyone is a genius.
It's just that some people are too stupid to realize it.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.4 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE7E4kW8RPXBhiMqewRAtw+AJ98D2Xd67xLsObqvIk2yHX3hFGjHACfdT+6
ClwQOSQjYyN5V0zRf29lDvI=
=NKQv
-----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
|