| Internet, Networking, and Wireless Discussion of networking, internet, and wireless including Apple's Airport products. |
| Post Reply | New Thread | Subscribe |
|
|
Thread Tools |
![]() Member Since: Jul 22, 2008
Posts: 2
![]() |
I have tried to create an application which would send a wireless signal from the iphone simulator to a windows computer running Windump, but my efforts have failed so far. It seems that some people on these forums are more knowledgeable of the TCP/IP coding of the mac, and I would like to know if there is anything wrong with my code, what I should do, and if there is anything critically wrong with it.
Any input would be welcome. int fd = -1; CFSocketRef socket; socket = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_STREAM, IPPROTO_TCP, 0, NULL, NULL); if ( socket == NULL) { NSLog(@"CfSocketCreate Failed"); }else{ if( socket ) { fd = CFSocketGetNative(socket); if (fd == -1) { NSLog(@"CfSocketGetnative Failed");} else{ int yes = 1; setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&yes, sizeof(yes)); struct sockaddr_in addr; memset(&addr, 0, sizeof(addr)); addr.sin_len = sizeof(addr); addr.sin_family = AF_INET; addr.sin_port = htons(9595); //port inet_aton("192.168.2.3", &addr.sin_addr); //ip adress NSData *address = [NSData dataWithBytes:&addr length:sizeof(addr)]; CFSocketError e = CFSocketSetAddress(socket, (CFDataRef)address); if(e != kCFSocketSuccess ) { NSLog(@"Could not bind to address"); }else{ char msg []= "helloworld"; CFDataRef Data = CFDataCreate(NULL, (const UInt8*)msg, sizeof(msg)); CFSocketSendData(socket,NULL, Data, 1000);} }} else { NSLog(@"No server socket"); } } |
| QUOTE Thanks | |
| Post Reply | New Thread | Subscribe |
| Thread Tools | |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|
|||||||
Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Wireless networking | Bluewolf | Internet, Networking, and Wireless | 8 | 02-24-2009 03:12 PM |
| Long time, no see... | youthpastor | Schweb's Lounge | 17 | 06-14-2008 01:39 AM |
| The Official iPhone thread | kaidomac | Apple Rumors and Reports | 7 | 06-30-2007 08:59 PM |
All times are GMT -4. The time now is 09:03 PM.
Powered by vBulletin