Function doesn't get executed

Hello, I am having troubles with my code. The following code is:

#include <Ethernet.h>
#include <SPI.h>

byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x7E, 0xAE };
IPAddress server ( 192, 168, 1, 223 );
IPAddress ipAddress ( 192, 168, 1, 224 );
IPAddress myDNS ( 8, 8, 8, 8 );
IPAddress myGateway ( 192, 168, 1, 1 );
IPAddress mySubnet ( 255, 255, 255, 0 );

EthernetClient client;

char c;

int bulb = 8;

void setup()
{
   pinMode( bulb, OUTPUT);
   digitalWrite(bulb, LOW);

   Serial.begin(9600);
   Ethernet.begin(mac, ipAddress, myDNS, myGateway, mySubnet);

   delay(1000);
   Serial.println("Connecting....");
}

void loop()
{
	void connectToServer();
	void readFromServer();
	void characterPrint();
	delay(500);
}

void connectToServer()
{
   if( client.connect(server, 80) )
   {
	Serial.println("Connected");
	client.println("GET /print.php");
	client.println("HTTP/1.1");
	client.println("Host: /localhost");
	client.println("user-agent: arduino/somethingorother");
	client.println();
	delay(1000);
   }
   else
   {
	Serial.println();
	Serial.println("Unable to Connect");
	client.stop();
   }
}

void readFromServer()
{
   if( client.available() )
   {
	c = client.read();
	delay(500);
   }
   else
   {
	Serial.println("Unable To Read From Client");
	Serial.println("Disconnecting");
	Serial.println();
	client.stop();
   }
}

void characterPrint()
{
   Serial.println(c);
}

When I upload it to the Arduino, I just prints "connecting...." and it doesn't execute the functions that I have called in the "void loop()". Any suggestions on what is wrong with the code? Thank You

What function calls in loop (other than delay())?

	void connectToServer();

is not a function call. Drop the void!

Mark

Thanks, everything is working fine

@mods, paulS, etc but why did the ops code build at all. You can't dec functions within functions and we where not within a class!

Mark

They're not declarations (no body), they're prototypes.
Perfectly legal.

Even so it makes no sense at that point in the code!

@op DO NOT DELETE THIS THREAD

Mark

You can put a prototype wherever you like.
What point are you trying to make?

Holmes4, please don't shout.

What use would a prototype be at that point in the code?. I can't see a possible use and therefore would expect and error message.

Mark

It's allowed by the language - why should there be an error?

Seriously, what's your problem?

Just don't see why!

Mark

Buy a copy of K&R

K&R still on of the best books I have on C :grin:
But prototypes are normally put in the include file. It tells the compiler that it will encounter a function meeting the specifications of the prototype. But basically you can put them anywhere as long as they appear before the actual function shows up in the compiler. The Arduino IDE actually generates the prototypes (to my understanding) but if you use for example Eclipse, you have to define them yourself.
In you case the prototypes are defined in the loop. So no actual function is called.

Even so it makes no sense at that point in the code!

What makes sense and what is legal are two different things. Looking at some of the code posted here, very, very different things.

holmes4:
What use would a prototype be at that point in the code?. I can't see a possible use and therefore would expect and error message.

The great thing about C++ is, if its allowed, there is usually a reason for it, even if its something really obscure.

Now with function prototypes, every one sees them as 'global' entities, and as such take the global scope for granted.
But prototypes follow the standard scope rules: "the prototype is only usable within the scope it has been declared in".

Maybe it can be seen as a "private non-member non-static function" ( no class ).

This sketch shows this effect:

#include "Arduino.h"
#ifdef DO_NOT_COMPILE
  //C++ will not see this prototype.
  //This is here to prevent the Arduino IDE from outputting its own prototype.
  void func();
#endif

void setup() {
  Serial.begin( 9600 );
  
  void func();
  func(); //Works fine.
}

void loop() {
  
  func(); //Error, cannot see prototype.
}

void func(){ Serial.println( "Call" ); }