Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development > iPhone SDK Development - Advanced Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old 06-09-2010, 06:38 AM   #1 (permalink)
Registered Member
 
Join Date: May 2010
Location: South Africa
Posts: 2
Von_Bernington is on a distinguished road
Question AsyncSocket: Problem connecting.

I am a n00b. Done years of programing in java, php , various scripting languages etc. Really enjoying this apple stuff.

My problem is : I am playing around with the AsyncSocket class (wrapper), trying to create a serial stream via my application to a middleware device.

The goal is to send text from the app to a hyperterminal screen: "Hello world for sockets"

Anyone know of a good tutorial?

I have played around with it, my current code being the following:

Code:
- (id)init {
	
	if(self =[super init])
	{
	
	sendSocket = [[[AsyncSocket alloc] initWithDelegate:self]autorelease];
	
	currentConnections = [[[NSMutableArray alloc] initWithCapacity:1]autorelease];
	
	[currentConnections addObject:sendSocket];
	
		isRunning = NO;
	}
	
	return self;

}
and where I call the socket object created :

Code:
-(IBAction) connect:(id) sender{
	
 if(![sendSocket connectToHost:@"192.168.123.6" onPort:4999 error:nil])
 {
	 [sendSocket connectToHost:@"192.168.123.6" onPort:4999 error:nil];
	 
	
 }
Thanx in advance. Viva WORLD CUP 2010 in South Africa .
Von_Bernington is offline   Reply With Quote
Old 06-19-2010, 12:52 PM   #2 (permalink)
Registered Member
 
Join Date: May 2010
Location: South Africa
Posts: 2
Von_Bernington is on a distinguished road
Default Solution found :D

Well basically , after further research , I found a pretty helpful resource online , which explains sockets , messaging and bonjour all in on great tutorial.

This example consists of 3 classes excluding the User Interface (UIViewController).

Message - that handles the message format

AsyncSocket - Wrapper class for network or serial port connections using BSD sockets as far as I can understand .

Message Broker - incorporating the above two classes and using them to put it all together

This tutorial can be found at :
HTML Code:
http://www.macresearch.org/cocoa-scientists-part-xxix-message
Thanx to Drew McCormack for this awesome tutorial!

Highly recommended for anyone who wants to use network connections to other device.
Von_Bernington 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



» Advertisements
» Online Users: 361
6 members and 355 guests
.Snipe, AragornSG, baja_yu, guusleijsten, hussain1982, Paul Slocum
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,645
Threads: 94,111
Posts: 402,862
Top Poster: BrianSlick (7,990)
Welcome to our newest member, leighec68
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:33 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0