Internet, Networking, and Wireless Discussion of networking, internet, and wireless including Apple's Airport products.

iPhone Wireless


Post Reply New Thread Subscribe

 
Thread Tools
edios

 
Member Since: Jul 22, 2008
Posts: 2
edios is on a distinguished road

edios is offline
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
edios

 
Member Since: Jul 22, 2008
Posts: 2
edios is on a distinguished road

edios is offline
By the way, the code is inside the ApplicationDidFinsihLaunching part of the code.
QUOTE Thanks

Post Reply New Thread Subscribe


« Wireless Internet in Stockholm? | Help with wireless router »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
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
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?