Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-17-2008, 04:59 PM   #1 (permalink)
New Member
 
Join Date: Nov 2008
Posts: 7
Default What is the best way to etablise an communication with an IP device ?

What is the best way to etablise an communication with an IP device ?

some proposition ?

thanks
john
lastiko is offline   Reply With Quote
Old 11-18-2008, 04:10 AM   #2 (permalink)
iPhone App Developer
 
chbeer's Avatar
 
Join Date: Sep 2008
Location: Berlin, Germany
Posts: 228
Default

What is a IP device? Did you read the documentation about "Networking & Internet" or CFNetwork?

Please try to find out yourself before asking such questions.
__________________
Learn vocabularies on iPhone? iVocabulary!
chbeer is offline   Reply With Quote
Old 11-18-2008, 04:28 AM   #3 (permalink)
Go Dealloc yourself!
 
Join Date: Oct 2008
Location: Central California
Posts: 130
Default

Code:
-(void)what:(NSString*)question
{
    NSString *magicAnswer = [NSString alloc] initWithMagic[question + telepathy]];
    if([magicAnswer isEqualToString: @"iPhone"])
        {
            self.wonder = 1;
            [magicAnswer release];
            return;
         }else{
            self.headache = 1;
            [magicAnswer release];
            return; 
          }
 }
Sorry, I am bored.
xnakx is offline   Reply With Quote
Old 11-18-2008, 05:41 AM   #4 (permalink)
New Member
 
Join Date: Nov 2008
Posts: 7
Default

Quote:
Originally Posted by chbeer View Post
What is a IP device? Did you read the documentation about "Networking & Internet" or CFNetwork?

Please try to find out yourself before asking such questions.
I think about an Lighting System like Lutron for example or amx or crestron
lastiko is offline   Reply With Quote
Old 11-18-2008, 10:41 AM   #5 (permalink)
Go Dealloc yourself!
 
Join Date: Oct 2008
Location: Central California
Posts: 130
Default

if i remember correctly Lutron uses rs232 to actually control the devices but the web manager it all HTTP. you will need to lookup on how to use NSURLConnection with authentication.
xnakx is offline   Reply With Quote
Old 11-18-2008, 11:19 AM   #6 (permalink)
New Member
 
Join Date: Nov 2008
Posts: 7
Default

Quote:
Originally Posted by xnakx View Post
if i remember correctly Lutron uses rs232 to actually control the devices but the web manager it all HTTP. you will need to lookup on how to use NSURLConnection with authentication.

yep but it's also possible with the same protocol over TCP/IP
thanks for the NSURLConnection information

regards
J.
lastiko is offline   Reply With Quote
Old 11-18-2008, 11:22 AM   #7 (permalink)
Go Dealloc yourself!
 
Join Date: Oct 2008
Location: Central California
Posts: 130
Default

NSURL rides on TCP/IP.

are you wanting to handle packet generation and SYN/ACK responses yourself?
xnakx is offline   Reply With Quote
Old 11-18-2008, 11:33 AM   #8 (permalink)
New Member
 
Join Date: Nov 2008
Posts: 7
Default

Quote:
Originally Posted by xnakx View Post
NSURL rides on TCP/IP.

are you wanting to handle packet generation and SYN/ACK responses yourself?
yes , in fact i want to control some device with TCP/IP like VideoProj, or Camera , and more

My only problem is the way to send some data on a specific port and the stability of the wifi connection and reconnection
i begin just on iphone programming , i just receive the iphone cook book today
lastiko is offline   Reply With Quote
Old 11-18-2008, 05:42 PM   #9 (permalink)
New Member
 
Join Date: Nov 2008
Posts: 7
Default

ok now the iphone was connected when i press the button :

Code:
-(IBAction)Envoie{
	
	unsigned char aBuffer[20];
	NSString *myString = @"Test string.";
	const char *utfString = [myString UTF8String];
	NSData *myData = [NSData dataWithBytes: utfString length: strlen(utfString)];
	[myData getBytes:aBuffer];
	NSURL * HPurl = [NSURL URLWithString:@"http://192.168.0.9:81"];
	if([myData writeToURL:HPurl atomically:true]);	
}

but the data receive from 192.168.0.9 was

(0000942670) CONNECT
(0000942673) Iphone envoie : PUT / HTTP/1.0
User-Agent: Write_to_URL/1.0 CFNetwork/339.5 Darwin/9.5.0 (i386) (MacBookPro1,2)
Content-Length: 0


but i didn't send "PUT / HTTP/1.0
User-Agent: Write_to_URL/1.0 CFNetwork/339.5 Darwin/9.5.0 (i386) (MacBookPro1,2)"



and there is an other problem when i press the envoie button , he stay i blue

somebody can help me ?

thanks

Last edited by lastiko; 11-18-2008 at 05:46 PM.
lastiko is offline   Reply With Quote
Old 11-19-2008, 02:50 AM   #10 (permalink)
iPhone App Developer
 
chbeer's Avatar
 
Join Date: Sep 2008
Location: Berlin, Germany
Posts: 228
Default

Did you read the documentation about writeToURL? It says:
Quote:
Since at present only file:// URLs are supported, there is no difference between this method and writeToFile:atomically:, except for the type of the first argument.
So it should not support URLS other than file://... I'm not shure why it works but to make a PUT seems the intended behaviour.
__________________
Learn vocabularies on iPhone? iVocabulary!
chbeer is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On


Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,056
Threads: 38,845
Posts: 170,403
Top Poster: smasher (2,562)
Welcome to our newest member, develsolutions
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:23 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0