예제 #1
0
bool tcpServerClientReceive (TcpClient& client, char *data, int size)
{
	debugf("Application DataCallback : %s, %d bytes \r\n",client.getRemoteIp().toString().c_str(),size );
	debugf("Data : %s", data);
	client.sendString("sendString data\r\n", false);
	client.writeString("writeString data\r\n",0 );
	if (strcmp(data,"close") == 0)
	{
		debugf("Closing client");
		client.close();
	};
	return true;
}
void onReadyToSend(TcpClient& client, TcpConnectionEvent sourceEvent)
{
	// debug msg
	debugf("onReadyToSend");
	debugf("sourceEvent: %d", sourceEvent);

	// check condition
	if(sourceEvent == eTCE_Connected)
	{
		/* 
		 * T1 = t1
		 * H1 = 8
		 * P1 = 712.15
		 */
		client.sendString("#"+mac+"\n#T1#"+t1+"\n#H1#8\n#P1#712.15\n##", true);
	}
}