Get in touch with JAVA, TCP/IP, Mac OS X, iPhone and Objective C programming

September 23rd, 2009 by Speedy Leave a reply »

Hi Guys!

In the last weeks I thought about new projects (beside the Mikrokopter project). So I started to study Objective-C programming by myself to be able to code iPhone applications in future. A good start for doing that is the book “Cocoa Programming For Mac OS X” by Aaron Hillegass.
A good podcast to start with Objective-C from the real basics is also this one from Peter and Ingo:
Another good resource that I am using is the Stanford iPhone programming course, which is available over iTunes U and resources to the course are here:

Because the SPP Bluetooth profile is currently not supported by the iPhone (OS 3.1), data transfer has to be done over TCP/IP or some other “frickel-ware” tricks (Audio, Display and Camera, other BT-profiles, …).

So I have to put some energy in the field of embedded wireless webservers, TCP/IP protocol, debugging connections, snif packets, make connections from iPhone to an embedded (web)server and so on.

Today I did a first test with servers. I started a Java Server on the PC and connected to that server over telnet from the Mac mini in my local LAN over WiFi. All Bytes that are received by the server are displayed in the console. With the ESC Symbol transmitted from the Mac, the connection can be closed.

[cc lang=”java” width=”100%” ]

public class server{
public static void main(String[] args){
ServerSocket server;
Socket client;
InputStream in;
OutputStream out;

server=new ServerSocket(12345);

while (true){
int c=0;

Out.println(“client connected”);

out.write(“Hello, Welcome to speedyweb!\r\n”.getBytes());

while (c!=27){
while (in.available()>0){;
if (c==27) // ASCII für ESC
Out.println(“client disconnected”);
catch (Exception ex){

Here is a screenshot from the final console outputs and the sourcecode for the Java server:

Java on PC, telnet on Mac

Java on PC, telnet on Mac

Sourcefile; Required Class

Thanks to Adam B. for showing me how easy it is to code a server in Java.

ToDo’s for the next months:
* The Java console should display a connection which is established by an iPhone app.
* The Server should be an embedded WiFi server -> order an embedded WiFi module.
* Get practice in Objective-C programming, continue Stanford iPhone course
* Realize the path: iPhone (Simulator) -> embedded WiFi server
* Let some LEDs blink, dependent on the orientation of the iPhone (Simulator)
* Let some LEDs blink, dependent on some buttons in the iPhone App
* Pay the developer license fee to start developing on real iPhone hardware ($100)
* Having fun and thinking about nice tools of iPhone Apps together with embedded controllers



Leave a Reply