|
Subject: |
Re: CIPE: CipeTapIO::Send |
|
From: |
Damion Wilson <dwilson,AT,ibl,DOT,bm> |
|
Date: |
Mon, 9 Dec 2002 20:44:28 +0100 |
|
In-reply-to: |
<Pine.LNX.4.44.0212091843280.32748-100000@hlubocky.del.cz> |
OK, OK. I used the code from the Socket handler class to implement the Tap
handler class and didn't bother to change these. Those WSA_xxx macros are
defined as references to the "normal" Win32 I/O macros, but you're right,
they might just change in the future to be something else.
DKW
On Monday 09 December 2002 01:50 pm, you wrote:
> Hello Damion,
>
> I looking to code of CIPE 2.0pre15 in CipeTapIO.cpp in cipsrvr
> and see following code:
>
> void CipeTapIO::Send (CipePacketDescriptor &p_Buffer)
> {
> unsigned long l_BytesWritten;
>
> if (p_Buffer.length >= sizeof (p_Buffer.mac) && p_Buffer.length <=
> DescriptorSize()) {
> memcpy (p_Buffer.mac.destination, MAC(), sizeof (MACADDR)); //
> Ensures that we deliver to the local MAC address if (WriteFile (m_Handle,
> p_Buffer.buffer, p_Buffer.length, &l_BytesWritten, &m_OverlappedEx)) ;
> else if (WSAGetLastError() == WSA_IO_PENDING)
> GetOverlappedResult (m_Handle, &m_OverlappedEx, &l_BytesWritten,
> TRUE); else
> DbgPrint ("Adapter [%s] failed on write attempt\n",
> Name().c_str()); ResetEvent (m_OverlappedEx.hEvent);
> }
> }
>
>
> Why is in this code WSAGetLastError - it's only for sockets? I think that
> you want get last error from WriteFile operation. If it's true, I think
> that line must be:
>
> else if (GetLastError() == ERROR_IO_PENDING)
>
> Vladimir
>
> ---------------------------------------------------------------------------
> Vladimír Michl <Vladimir.Michl,AT,hlubocky,DOT,del,DOT,cz> Del a.s.,
> Strojírenská 38,
> Žďár nad Sázavou pobočka Olomoucká 355,
> Hlubočky-Mariánské Údolí tel: +420
> 585 353 548, fax: +420 585 352 364 http://hlubocky.del.cz