🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #6812

Env�o UDP a add broadcast 255.255.255.255

#6812
From: AMJ
Date: Mon, 19 May 2003 12:55
45 lines
2105 bytes
Buenas

Estoy intentando enviar un SOCK_DGRAM por broadcast a una direcci�n IP
255.255.255.255 con una mascara de subred  255.255.0.0.

Es posible hacerlo ? A una x.x.255.255 puedo hacerlo.

Mando el c�digo para comentarios
// SOCKET for sending

// Opens the Logic Channel (UDP->linkaje fragil)

// nLogicCh_Write = socket ( AF_INET, SOCK_DGRAM, IPPROTO_UDP );

if ( nLogicCh_Write == -1 ) {

    // Sock Ini FAILED on socket WT creation

    // Closes the Logical Channel to read

    close( nLogicCh_Read );

    return FALSE;

}

// Fills the Socket Descriptor

ssiWrite.sin_family = AF_INET;

ssiWrite.sin_addr.s_addr = inet_addr( "255.255.255.255" );

ssiWrite.sin_port = htons( STATEMACHINE_RECONFIGURADOR_COMM_PORT );

if ( setsockopt( nLogicCh_Write, SOL_SOCKET, SO_BROADCAST, &one,
sizeof(one)) != 0 ) {

    // Sock Ini FAILED on socket WT creation

}

nSentDataLen = sendto( nLogicCh_Write, aszUnitIDRqstMsg, nMsgLen, 0, (struct
sockaddr *)&ssiWrite, sizeof(struct sockaddr) );

if ( nSentDataLen != nMsgLen ) //ERROR
Technical Details
Message-ID: <baak8k$plr$1@unbe.sarenet.es>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.vmunix.org!feed.news.nacamar.de!bnewsoutpeer01.bru.ops.eu.uu.net!bnewsinpeer00.bru.ops.eu.uu.net!emea.uu.net!news.sarenet.es!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f86c8,d89ea83665385474,start
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2003-05-19 06:00:55 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.vmunix.org!feed.news.nacamar.de!bnewsoutpeer01.bru.ops.eu.uu.net!bnewsinpeer00.bru.ops.eu.uu.net!emea.uu.net!news.sarenet.es!not-for-mail
From: "AMJ" <martinez.a@ikusi.es>
Newsgroups: es.comp.os.linux.programacion
Subject: Env�o UDP a add broadcast 255.255.255.255
Date: Mon, 19 May 2003 14:55:47 +0200
Organization: SARENET
Lines: 47
Message-ID: <baak8k$plr$1@unbe.sarenet.es>
NNTP-Posting-Host: 194.30.89.105
X-Trace: unbe.sarenet.es 1053348948 26299 194.30.89.105 (19 May 2003 12:55:48 GMT)
X-Complaints-To: usenet@unbe.sarenet.es
NNTP-Posting-Date: Mon, 19 May 2003 12:55:48 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106