• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
OTSndUData - problem on Mac OS 9
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

OTSndUData - problem on Mac OS 9


  • Subject: OTSndUData - problem on Mac OS 9
  • From: Igor garnov <email@hidden>
  • Date: Mon, 16 Feb 2004 17:20:28 +0300

Hello,

I experience a problem with my application on Mac OS 9.
My task is among others to ping a range of hosts. To do that, I create one endpoint with the following code:

OSStatus OS9CreatePingSocket( EndpointRef* lpEndpoint )
{
OSStatus res;
OTConfigurationRef icmpConfRef;

icmpConfRef = OTCreateConfiguration( kRawIPName );
if ( icmpConfRef )
{
*lpEndpoint = OTOpenEndpointInContext ( icmpConfRef,
0, 0, &res, OTccp );
if ( res == kOTNoError )
{
res = OTBind( *lpEndpoint, nil, nil );
if ( res == kOTNoError )
{
OTSetNonBlocking( *lpEndpoint );
AddToLog( "\pPing endpoint created" );
}
else OTCloseProvider( *lpEndpoint );
}
else OTDestroyConfiguration( icmpConfRef );
}
else AddToLog( "\pOTCreateConfiguration returned zero" );

return res;
}

I check the returned value - it is OK.
This function is called from MPTask, that runs in the loop.

After that, in this loop I call this function in response to a message from my primary thread.

struct MY_PING
{
UInt8 Type;
UInt8 Code;
UInt16 Checksum;
UInt16 id;
UInt16 SeqNum;
OTTimeStamp Timestamp;
};
typedef struct MY_PING MY_PING;

OSStatus OS9Ping( EndpointRef ep, unsigned long ulIP, OTTimeStamp* lpTimestamp )
{
OSStatus res;
InetAddress dest_addr;
TUnitData tData;
MY_PING myPing;

OTInitInetAddress( &dest_addr, 0, ulIP );

myPing.Type = ICMP_ECHO;
myPing.Code = 0;
myPing.SeqNum = 1;
myPing.id = kOurMagic;

OTGetTimeStamp( &( myPing.Timestamp ) );
*lpTimestamp = myPing.Timestamp;

myPing.Checksum = 0;
myPing.Checksum = ChecksumBuffer( (UInt16 *)&myPing, sizeof( myPing ) );

MacZeroMemory( &tData, sizeof( tData ) );
tData.addr.len = sizeof( dest_addr );
tData.addr.buf = (unsigned char *) &dest_addr;
tData.udata.len = sizeof( myPing );
tData.udata.buf = (UInt8 *) &myPing;

res = OTSndUData( ep, &tData );

return res;
}

And my application crashes in the call to OTSndUData.

What can be the reason?

Regards,

Igor
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: OTSndUData - problem on Mac OS 9
      • From: Igor garnov <email@hidden>
  • Prev by Date: Re: CFSocket completeness
  • Next by Date: Trying to make a simple xinetd app run
  • Previous by thread: Re: CFSocket completeness
  • Next by thread: Re: OTSndUData - problem on Mac OS 9
  • Index(es):
    • Date
    • Thread