Using Methods/subroutines to send info to an ehternet client

Hi i'm having trouble using 'client.print' in a subroutine.

In the 'void loop' I'm using

'// Ethernet outputs here
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
//Serial.write(c); //dont need to feed back once working
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connnection: close");
client.println();
client.println("");
client.println("");
// add a meta refresh tag, so the browser pulls again every 5 seconds:
client.println("<meta http-equiv="refresh" content="5">");'

To start up the output to the client

then using

' client.print("System started ");
// need a method for the next set of lines as they will be used over and over

client.print("\t");
client.print(day(sEpoch));
client.print("/");
client.print(month(sEpoch));
client.print("/");
client.print(year(sEpoch));
client.print(" ");
buff = hour(sEpoch);
if (buff < 10) {
client.print ("0");
}
client.print(buff);
client.print(":");
buff = minute(sEpoch);
if (buff < 10) {
client.print ("0");
}
client.print(buff);
client.print(".");
buff = second(sEpoch);
if (buff < 10) {
client.print ("0");
}
client.print(buff);
client.println("
");
.....
To send things off to the intranet
Now because this last bit is eventually going to be used 12 times over with different values of 'sEpoch' I would like to put it into a method all of its own like

void Clientprn(unsigned long t)
{
client.print("\t");
client.print(day(t));
client.print("/");
........
}

However when I do this the subroutine is just skiped over and nothing is sent out.

Sorry but the whole code including getting/converting the values of the analog inputs and getting NTP date time stamps is too long to attach.
Suggestions welcom.

In the 'void loop'

Otherwise known as the loop() function.

I'm using

OK.

To start up the output to the client

then using

client is local to loop(). You need to pass that instance to the new function.

void Clientprn(unsigned long t)
{

The return type is fine, but you need to pass client to the function, too.

void Clientprn(EthernetClient &client, unsigned long t)
{

Then call it:

Clientprn(client, sEpoch);

Suggestions welcom.

Use code boxes foe your code (the # on the posting tool bar).