I was wondering if anyone has worked with raw sockets and/or could help me
with the following problem.

I am trying to bind a raw/raw socket, so I can build the MAC header, and am
running into trouble trying to use the NetSocketAddrRawType in the way the
documentation, from Palm, suggest.

Basically I do the NetLibConnect first, using NetLibIFGet(nAppNetRefnum, 0,
&ifCreator, &ifInstance); to get my Creator and Instance.

Then I do a nSocket = NetLibSocketOpen( nAppNetRefnum,
netSocketAddrRaw,netSocketTypeRaw, netSocketProtoIPRAW,AppNetTimeout, &err);

All this goes find till I get to the NetLibSocketBind, according to the
docs,

" Raw sockets in the netSocketAddrRaw domain with no protocol

In this case, you must bind the socket to an interface using

NetLibSocketBind, passing a NetSocketAddrRawType

structure for the socket address. The instance and creator

specify which interface the caller wants to receive raw

packets from."



If I use the NetSocketAddrRawType structure, in my NetLibSocketBind it bombs
out. I set the struct up as follows:

NetSocketAddrRawType netRawType;

netRawType.family  = AF_RAW;

netRawType.ifInstance = ifInstance;

netRawType.ifCreator = ifCreator;

NetLibSocketBind( nAppNetRefnum,
                  nSocket,
                  (NetSocketAddrType*)&netRawType,
                  sizeof(netRawType),
                  AppNetTimeout,
                  &errno);



Thing is though if I use a NetSocketAddrINType

structure then the NetLibSocketBind says everything is fine, but then this
does not jive with the docs.



My NetSocketAddrINType looks like this:

mysockettype.family = AF_INET;

mysockettype.port = 0;

mysockettype.addr = 0;



Does anyone see anything I'm doing inherently wrong here or have any
suggestions:?



Thanks Carl




-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to