Article View: comp.sys.mac.oop.powerplant
Article #74Receiving RawIP with OT
From: Antoine Bruguier
Date: Sat, 17 Jul 1999 00:00
Date: Sat, 17 Jul 1999 00:00
75 lines
3628 bytes
3628 bytes
I'm using CW PowerPlant to build an application which would receive
every IP packet. But because PowerPlant does not provide the righ
classes to do this, I resolved to use directly the OpenTransport API. I
wrote the piece of code just below.
But it does not work, or at least, I do not receive anything. At
each new loop, the flags are equal to zero, which mean, there's nothing
received. Is there a bug in this code?
Maybe I'm ACTUALLY receiving nothing. In instance, if I ping myself,
am I supposed to receive something or not? And will I receive all IP
packets, even the one who are not addressed to me but also to other
hosts?
Thanks , Antoine
==================================
J'utilise CW PowerPlant pour ecrire une application qui doit
recevoir tout les packets IP. Mais comme PowerPlant ne permet pas cela,
j'ai decide d'ecrire moi meme le code en utilisant directement les APIs
de OpenTransport. J'ai ecrit le code ci dessous.
Mais il ne fonctionne pas, ou du moins, je ne recoit rien. A chaque
boucle, les flags sont a zero, ce qui veut dire que il n'y a rien de
recu. Y-a-t-il un bug?
Peut etre que je ne recoit VRAIMENT rien. Par exemple, si je me ping
moi meme, est que je suis suppose recevoir quelquechose? Et est ce que
je peux recevoir les packets IP, meme si ils sont adresses a d'autres
hotes?
Merci, Antoine
==================================
MyThread::Run()
{
TUnitData data;
OTFlags flags;
mOTConfiguration = ::OTCreateConfiguration("rawip");
mEndPointRef = ::OTOpenEndpoint(mOTConfiguration, 0, &mEndPointInfos,
&theErr);
ThrowIfError_(theErr);
while(mRunning)
{
data.addr.buf = new unsigned char[256];
data.opt.buf = new unsigned char[256];
data.udata.buf = new unsigned char[256];
data.addr.maxlen = 256;
data.opt.maxlen = 256;
data.udata.maxlen = 256;
::OTRcvUData(mEndPointRef, &data, &flags);
if(flags != 0)
{
if(data.addr.len != 0 || data.opt.len != 0 || data.udata.len != 0)
{
mTerminalPane->SetTextPtr(nil,0);
mTerminalPane->Insert(data.addr.buf, data.addr.len, nil, true);
mTerminalPane->Insert(data.opt.buf, data.opt.len, nil, true);
mTerminalPane->Insert(data.udata.buf, data.udata.len, nil, true);
}
}
delete data.addr.buf;
delete data.opt.buf;
delete data.udata.buf;
Sleep(1000);
}
::OTDestroyConfiguration(mOTConfiguration);
mRunning = true;
return nil;
}
Technical Details
Message-ID:
<3790E8ED.A2B50A4F@soon.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 101ec9,f3c8fd29c5b66a6b,start X-Google-Attributes: gid101ec9,public X-Google-Thread: f7f77,f3c8fd29c5b66a6b,start X-Google-Attributes: gidf7f77,public X-Google-Thread: f635e,f3c8fd29c5b66a6b,start X-Google-Attributes: gidf635e,public X-Google-Thread: 109005,f3c8fd29c5b66a6b,start X-Google-Attributes: gid109005,public X-Google-Thread: 1155bd,f3c8fd29c5b66a6b,start X-Google-Attributes: gid1155bd,public From: Antoine Bruguier <antoine.bruguier@soon.com> Subject: Receiving RawIP with OT Date: 1999/07/17 Message-ID: <3790E8ED.A2B50A4F@soon.com> X-Deja-AN: 502189741 Content-Transfer-Encoding: 7bit X-Accept-Language: fr Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353" X-Complaints-To: abuse@isdnet.net X-Trace: news2.isdnet.net 932244040 21826 195.154.24.213 (17 Jul 1999 20:40:40 GMT) Mime-Version: 1.0 Reply-To: antoine.bruguier@soon.com NNTP-Posting-Date: 17 Jul 1999 20:40:40 GMT Newsgroups: comp.sys.mac.oop.powerplant,comp.sys.mac.programmer.help,comp.sys.mac.programmers.misc,fr.comp.sys.mac.programmation,comp.sys.mac.programmer.codewarrior