Article View: es.comp.os.linux.programacion
Article #7917Re: UDP socket - simple question
From: Angel
Date: Mon, 20 Jan 2003 08:32
Date: Mon, 20 Jan 2003 08:32
60 lines
2764 bytes
2764 bytes
MSF presumiblemente dijo el dia Dom 19 Ene 2003 21:54:
> Hi
>
> I've just started programing, using C language and UDP Sockets (in Linux);
> (so I have a few problems)
>
>
> I have two programs (client and server);
> -Client send (interactive) request information about server network
> configuration (/sbin/ifconfig)
>
> -Server
> if(!strcasecmp(dgram,"interface")){
> should do this request
> system("/sbin/ifconfig")
> and send it to client
> ??????? HOW ??????
>
> Simple use
> variable1 = system("/sbin/ifconfig")
> sprintf("%s",variable1)
> doesn't work (problem with buffer, even I set it bigger),
do you initialize the buffer?? remember you need one character more for
"\0" (End Of Stream)
> but how send it to Client?
check that:
http://www.cs.cf.ac.uk/Dave/C/node28.html#SECTION002800000000000000000
> (maybe first write to file, and then to buffer - gradually, after this
> send it to Client
> - if it's good idea - how write it?
well, you must do it on the fly, for security, and one more... don't use
the function system ( it's too easy to exploit ).
>
> Big thanks for any answer
dnd.
>
> with regards
> Martin
PD: it's a spanish newsgroup.
Spanish version ;) :
tienes el buffer inicializado??, recuerda que tienes q dejar un caracter
mas para el caracter nulo de la linea.
mira esto:
http://www.cs.cf.ac.uk/Dave/C/node28.html#SECTION002800000000000000000
bueno, deberias hacerlo directamente, asi tendras menos problemas de
seguridad, ademas mejor que no utilizes la funcion "system", ya q esta se
puede exploitear demasiado facilmente.
Traducido por: yo mismos :P.
--
Liso -Eadem Mutata Resurgo-
Linux has you...
Technical Details
Message-ID:
<b0gbtt$ocf92$1@ID-148170.news.dfncis.de>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!80-24-166-73.uc.nombres.ttd.ES!not-for-mailReferences:
<b0f39s$1g8p$1@foka.acn.pl>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f86c8,3672983a83160639 X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2003-01-20 00:27:43 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!80-24-166-73.uc.nombres.ttd.ES!not-for-mail From: Angel <a.lis.quita.esto@hotmail.com> Newsgroups: es.comp.os.linux.programacion Subject: Re: UDP socket - simple question Date: Mon, 20 Jan 2003 09:32:51 +0100 Organization: Donde Me Dejan S.A. Lines: 60 Message-ID: <b0gbtt$ocf92$1@ID-148170.news.dfncis.de> References: <b0f39s$1g8p$1@foka.acn.pl> Reply-To: a.lisarrobabussitel.es@hotmail.com NNTP-Posting-Host: 80-24-166-73.uc.nombres.ttd.es (80.24.166.73) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1043051261 25574690 80.24.166.73 (16 [148170]) User-Agent: KNode/0.6.1