Ethernet ,MQTT connection

Hi , i’m working in project Iot and i want to connect my arduino mega 2560 to the internet (ethernet shield wiznet w5100 ) but i’can’t connect it in the office , but when i trided to connect it at home it connect easy ho i can do it .

link of DATASHEET of the shild :

I had attached also the source code , please help me solve this problem thanks .

mqtt_basic.ino (1.92 KB)

If it works at home but not at the office you need to contact your IT department to allow the ports you are using in your sketch.


Different networks use different ranges of IP addresses so using a static IP is not going to work. Use DCHP to get a dynamically assigned IP address. The Arduino IDE includes Ethernet examples such as DhcpAddressPrinter which show how to use DHCP.