Connecting with TCPclient code, and PING issues

Hi @Hootie81

Each one of the UDP.write() functions will generate a packet, which is not what you want. Most DNS requests are under 128 bytes, so if you make a 128-byte buffer, copy all the bytes you want to send into it, and then do just one write with the entire buffer, you will get the desired behavior.

Another user made a class to layer on top of the built-in UDP class that does just that

//----- UDP + overloading the inappropriate UDP functions of the Spark Core (REQUIRED !)
class myUDP : public UDP {
private :
	uint8_t myBuffer[128];
	int offset = 0;
public :
	virtual int beginPacket(IPAddress ip, uint16_t port){
		offset = 0;
		return UDP::beginPacket(ip, port);
	};
	virtual int endPacket(){
		return UDP::write(myBuffer, offset);
	};
	virtual size_t write(uint8_t buffer) {
		write(&buffer, 1);
		return 1;
	}
	virtual size_t write(const uint8_t *buffer, size_t size) {
		memcpy(&myBuffer[offset], buffer, size);
		offset += size;
		return size;
	}
};

myUDP Udp;