 |
 |
|
 |
11-17-2008, 05:59 PM
|
#1 (permalink)
|
|
New Member
Join Date: Nov 2008
Posts: 7
|
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
|
|
|
11-18-2008, 05:10 AM
|
#2 (permalink)
|
|
iPhone App Developer
Join Date: Sep 2008
Location: Berlin, Germany
Posts: 228
|
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!
|
|
|
11-18-2008, 05:28 AM
|
#3 (permalink)
|
|
Go Dealloc yourself!
Join Date: Oct 2008
Location: Central California
Posts: 130
|
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.
|
|
|
11-18-2008, 06:41 AM
|
#4 (permalink)
|
|
New Member
Join Date: Nov 2008
Posts: 7
|
Quote:
Originally Posted by chbeer
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
|
|
|
11-18-2008, 11:41 AM
|
#5 (permalink)
|
|
Go Dealloc yourself!
Join Date: Oct 2008
Location: Central California
Posts: 130
|
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.
|
|
|
11-18-2008, 12:19 PM
|
#6 (permalink)
|
|
New Member
Join Date: Nov 2008
Posts: 7
|
Quote:
Originally Posted by xnakx
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.
|
|
|
11-18-2008, 12:22 PM
|
#7 (permalink)
|
|
Go Dealloc yourself!
Join Date: Oct 2008
Location: Central California
Posts: 130
|
NSURL rides on TCP/IP.
are you wanting to handle packet generation and SYN/ACK responses yourself?
|
|
|
11-18-2008, 12:33 PM
|
#8 (permalink)
|
|
New Member
Join Date: Nov 2008
Posts: 7
|
Quote:
Originally Posted by xnakx
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
|
|
|
11-18-2008, 06:42 PM
|
#9 (permalink)
|
|
New Member
Join Date: Nov 2008
Posts: 7
|
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 06:46 PM.
|
|
|
11-19-2008, 03:50 AM
|
#10 (permalink)
|
|
iPhone App Developer
Join Date: Sep 2008
Location: Berlin, Germany
Posts: 228
|
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!
|
|
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Advertisements |
» Online Users: 464 |
| 37 members and 427 guests |
| al31, alexanderlonsky, AXP, bartender, CanadaDev, CHV, dany88, davidloew, delphipgmr, DorkyMohr, dre, gate491, ggalante, grouchal, HUngable, iseff, issya, japaternoster, jorgmart, KennyChong, kev12345, kvoyt, learnSomething, listingboat, lukeca, macstar, MacSteve85, masc2279, mebarron, RegularKid, siemens, Slecorne, Stephane.tamis, supudo, TunaNugget, wheli, zmarco |
| Most users ever online was 779, 05-11-2009 at 10:55 AM. |
» Stats |
Members: 21,492
Threads: 35,775
Posts: 156,707
Top Poster: smasher (2,448)
|
| Welcome to our newest member, gate491 |
|