Thanks for the answer.
Yes, I'm working as root but I'm still unable to find a solution to my problem. 
Unfortunately I've to implement this blessed ping function in C++ inside my 
cocoa app. I've used the following code without any results: 
 
 struct hostent     *hp      = 0;
 struct sockaddr_in dest;
 
 int sockIcmp = socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP);
        
 hp = gethostbyname("10.63.10.70");
 memcpy(&(dest.sin_addr),hp->h_addr,hp->h_length); 
 dest.sin_family = AF_INET; 
  
 int bwrote = sendto(sockIcmp,buf_out,buf_out_size, (sockaddr*)&dest, 
sizeof(dest));
 
 
 To open the socket I'd to substitute the SOCK_RAW with SOCK_DGRAM. In this way 
the socket is succesfully open, but the function sendto returns always -1.
 
 Is there some other way to implement a ping function in C++ working on Mac OS 
X? (this code, in Linux works fine).
 
 Thanks in advance for any idea.
 
 Luca


> ----------------------------------------
>> From: [EMAIL PROTECTED]
>> To: cocoa-dev@lists.apple.com
>> Date: Fri, 22 Aug 2008 18:12:41 +0100
>> Subject: failing opening socket
>> 
>> 
>> Hi all.
>> 
>> I'm porting a Linux project (using sockets to implement a ping function) on 
>> Mac OS X. My problem is that the function:
>> 
>> int sock_icmp = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
>> 
>> returns always -1.
>> 
>> Where is my mistake? For me is the very first time using socket on Mac.
>> 
>> Thanks in advance for any idea.
>> 
>> Luca.
>> 
>> 
>> 
>> 
>> _________________________________________________________________
>> Win New York holidays with Kellogg’s & Live Search
>> http://clk.atdmt.com/UKM/go/107571440/direct/01/_______________________________________________
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/luca_ciciriello%40hotmail.com
>> 
>> This email sent to [EMAIL PROTECTED]
> _________________________________________________________________
> Win New York holidays with Kellogg’s & Live Search 
> http://clk.atdmt.com/UKM/go/107571440/direct/01/
_________________________________________________________________
Win a voice over part with Kung Fu Panda & Live Search   and   100’s of Kung Fu 
Panda prizes to win with Live Search
http://clk.atdmt.com/UKM/go/107571439/direct/01/_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to