• 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
FW: failing opening socket
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FW: failing opening socket


  • Subject: FW: failing opening socket
  • From: Luca Ciciriello <email@hidden>
  • Date: Mon, 25 Aug 2008 07:28:58 +0100
  • Importance: Normal

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@hidden
>> To: email@hidden
>> 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 (email@hidden)
>>
>> 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:
>>
>> This email sent to email@hidden
> _________________________________________________________________
> 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 (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: FW: failing opening socket
      • From: "Michael Ash" <email@hidden>
References: 
 >failing opening socket (From: Luca Ciciriello <email@hidden>)

  • Prev by Date: Re: *** -[NSSavePanel _blocksActionWhenModal:]: message sent to deallocated instance 0x15a05e50
  • Next by Date: Re: *** -[NSSavePanel _blocksActionWhenModal:]: message sent to deallocated instance 0x15a05e50
  • Previous by thread: Re: failing opening socket
  • Next by thread: Re: FW: failing opening socket
  • Index(es):
    • Date
    • Thread