Problems with School Proxy by using MQTT protocol


hi all,

now doing project of mqtt protocol using arduino. have arduino board , arduino ethernet shield. use ethernet shield connect internet , shield connected net wire in school. proxy server set in school need make proxy settings connect outside networks. it's same arduino board. when use sample file of mqtt library, need modify code. code below:

code: [select]

#include <pubsubclient.h>
#include <spi.h>
#include <ethernet.h>

// update these values suitable network.
byte mac[]    = {  0x90, 0xa2, 0xda, 0x0d, 0xf2, 0x45 };
byte server[] = { 212, 72, 74, 21 }; //mqtt dashboard
//byte ip[]     = { 172, 16, 0, 100 };
byte proxy[] = { 10, 204, 18, 202 }; // school proxy

void callback(char* topic, byte* payload, unsigned int length)
{
 // handle message arrived
}

ethernetclient ethclient;
pubsubclient arduino(server, 1883, callback, ethclient);

void setup()
{
 ethernet.begin(mac);
 serial.begin(9600);
 serial.println("connecting...");
 serial.println();
 delay(500);
 int eth=0;
 while (eth==0)
 {
   serial.println("proxy connecting...");
   eth = ethclient.connect(proxy, 3128);
 }
 serial.println("proxy connected!");
 serial.println();
 
 while ((arduino.connect("niunai1221"))==0)
 {
   serial.println("mqtt connecting...");
   delay(1000);
 }
 serial.println("mqtt connected!");
 arduino.publish("outtopic1221","hello world");
}

void loop()
{
 arduino.loop();
}



the code
code: [select]
ethclient.connect(proxy, 3128) connect arduino school proxy successfully, after that, code
code: [select]
arduino.connect("niunai1221") didn't work.

i not english speaker, hope understand words. waiting reply~

anybody here?


Arduino Forum > Using Arduino > Programming Questions > Problems with School Proxy by using MQTT protocol


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62