Connection not possible

new discussion1

In the above connection when i am trying with case1 its working with some code. But when i change its position (as per case 2) the same code not working and connection not possible to make. Can u please help me why that problem is showing? What mistake i am making here can u please tell me.

Please insert your code according the forum rules - using code tags.

I think that code can be readable.

Can any one please help me by giving solutions or detect the problem.

But you will get faster and better help if you post all your code as requested by the forum guidelines.

what are the MAC and IP addresses of the devices in your diagram? would help making sure what the code is attempting to communicate with

what does the "Client" (triangle) represent in your diagram? is it a 3rd Ethernet device? what model?

if you're using Ethernet, why is there a WiFi access point? or are you just using it as a Ethernet router/hub?

will your code work if you connect boath Arduino ethernet shields together thru a Ethernet router/hub.

Thanks for your reply.

what are the MAC ......Ans: server is 192, 168, 127, 150 and ip is 192, 168, 127, 150

what does the "Client" (triangle) represent in your.. **Ans: yes. Ethernet client which using as a client. **

if you're using Ethernet, why is there a WiFi access point? or are you just using it as a Ethernet router/hub? Ans: Wifi to create a server type to fwd the data to the client.Here i am just trying to forward some data from segment 1 to segment 2.

will your code work if you connect boath Arduino ethernet shields together thru a Ethernet router/hub**.Ans: The case 1 is working fine. But the case 2 where only position of ap and clients are change is not working.I was working earlier fine. But not able to detecting why suddenly that not working.**

these are IP addresses

in order to better understand what your diagram shows, i'd like the MAC and IP addresses of all the devices: Arduino, client and AP

don't understand why you need WiFi if you're just using Ethernet. Arduino WiFi code needs different libraries, functions, and SSID and password

it's not clear what your case 1 and case 2 are. don't understand what client is between the Arduino and access point

in order to better understand what your diagram shows, i'd like the MAC and IP addresses of all the devices: Arduino, client and AP-- actually in that case not using any harcode mac address so using the default one.

don't understand why you need WiFi if you're just using Ethernet. Arduino WiFi code needs different libraries, functions, and SSID and password. : But please tell me how can i make the connection and forward the data from one end to another.For that either i need to connect use the crossover cable(which i cannot as two arduino will place in 20 meter distance) or any switch/ap/bluetooth to connect to the server.If you have any alternative solution to these (wireless connection) then please tell me.

it's not clear what your case 1 and case 2 are. don't understand what client is between the Arduino and access point: In case 1 the client is using at the place of ap.Which means the arduino shield connected to ap. and the case2 the ap is placed at the place of client which means in connection it will connected to directly the first arduino+ethernet shield. Client is just for accessing the data from ap and forward it to another arduino.

If u have any tutorial link which give the process how to do wireless communication between 2 arduino then please share.

it's unclear what you're trying to do

any ethernet device can communicate with any other Ethernet device that it can reach, using MAC addresses.

Ethernet originally used coax cable. Starlan allowed Ethernet devices to communicate over twisted pair wiring and RJ45 connectors. it used a star topology from a central hub

you can connect them thru a hub/switch (see hub above)

don't both arduino's have ethernet shields?

why do you need a "client" to forward (?) an Ethernet frame?

why do you need a WiFi tutorial if you have Ethernet shields not WiFi devices?

Thanks for your reply.

it's unclear what you're trying to do-- just want to make a connection where the data will generated by the first arduino (from the command by a interactive display /input device) move to the second arduino. The basic target is from a display unit some action will take from one end and other end there a machine will work based on the applied command.

you can connect them thru a hub/switch (see hub above)- but concept or architecture is still not clear to me. As i understand from ur idea that a ap/router/hub is enough to make connection between two arduino+ethernetshield using. If that so then how to make the connection arduino+ethernetshield(a lan cable to hub/router/ap) and then what how can other end can able to connect with that ap. Or you mean to say arduino+ethernetshield (wireless connection to hub/ap using ip and server ip) and same way other end will access it.better if u can share me any tutorial how to do that. I found 1 https://arduinogetstarted.com/tutorials/communication-between-two-arduino but are mean to say the same.

don't both arduino's have ethernet shields?- yes they have

why do you need a "client" to forward (?) an Ethernet frame?-- If it can retrieve the data without a client then that will be great.

why do you need a WiFi tutorial if you have Ethernet shields not WiFi devices? I mean to say any tutorial which will clear the concept and connection coding based on your idea.

i guess there's confusion about physical and and logical(?) connection

what is needed to physically connect 2 ethernet devices and what is needed to connect 2 applications

as already mentioned, early Ethernet devices were connected with coax cable. MAC addresses are hardcoded with every Ethernet device. and Ethernet device will accept/process an Ethernet frame with its MAC address

today's 10/100/1000 MB devices have RJ-45 connectors and can be connected using a hub/switch.

applications typically communicate above the IP layer using TCP packets. IP packets use IP addresses that are typically assigned by a DHCP server, typically part of a IP router

WiFi routers require SSID/password to obtain access with. this prevents anyone from using a neighbors WiFi. while this is often referred to a connection, it is not the same as establishing a TCP socket connection to an application on some other device which may be in the same room or across the world


    if (Ethernet.begin (mac) == 0) {
        Serial.println ("Failed to configure Ethernet using DHCP");
        if (Ethernet.hardwareStatus () == EthernetNoHardware) {
            Serial.println ("Ethernet shield was not found. Sorry, can't run without hardware. : (");

the above code seems wrong

  • shouldn't the test for the presence of Ethernet hardware be first?
  • the comment for Ethernet.begin() suggests that is obtains an IP address from a DHCP server. but from the reference page it looks like other options are required. more likely you need the case where the code assigns an IP address to Ethernet which is done later
        if (Ethernet.linkStatus () == LinkOFF) {
            Serial.println ("Ethernet cable is not connected.");
        }
        Ethernet.begin (mac, ip);

see this example

1 Like

Thanks for your detailed way of clarification. But sorry to say still concept not clear to me.
new discussion1 extended
Are you talking about the connection way 1or 2. If that is 1 then i have tried with that as i shared u the link of the example above. I followed everything but still nothing happening (though in that case i am facing some challenging to check the ip address of Ethernet shield. Is there any way to check it. Mac i am keeping the default one.)

If you will say the connection string 2 then how the Ethernet shield will2 will connect the router without an client. (i am not trying to use here dhcp)

as already stated, Ethernet does not require any device (hub/switch/router) to work. early ethernet (1Mb) just used coax cable and had to support collision detection, csma/cd when multiple devices attempted to transmit at the same time

but todays ethernet interfaces typically have an rj-45 connector and are typically connected thru a hub/switch/router having rj-45 jacks.

i believe a hub simply retransmits what it receive on one port to all other port, emulating a coax cable. a switch keeps tracks of which MAC addresses are associate with each port and only forwards Ethernet frames destined for a specific MAC to that port, otherwise it retransmits the frame to all ports. A router similarly forwards IP packets using IP addresses.

i believe a WiFi router will act like any other router, but will also be a WiFi access point which requires a WiFi device to connect to it with an SSID and password. an SSID/password are not needed with a wired Ethernet connection


many of todays routers also have DHCP servers to assign IP addresses when it receives an Ethernet frame with a previously unknown MAC ID.

in all cases, coax/hub/switch/router, a client nor server is required in between the ethernet devices to forward ethernet frames or IP packets.

it's not clear to me what a specific router does if it receives an IP packet with an IP address that does not match the MAC address in the Ethernet frame.

i would suggest writing some code that simply reports the IP address assigned to the Arduino after connecting it to your router.

it's not obvious to me that you can simply connect 2 Ethernet devices together with an Ethernet cable. i believe the physical interfaces are different depending on speed 10/100/1000 (i doubt a crossover cable would work)

presumably you are connecting each of your Arduino Ethernet boards with rj-45 plug using rj-45 cables to your router and wish to send IP packet (carried in Ethernet frames) from one Arduino to the other

new discussion1 extended1
So r u mean to the same. Now question is what will be the ipadress and server ip address as here we are connecting a hub/ap to make it server. On the other hand please tell me is the arduino+ethernet shield (segment 2) in receiver end can able to access/communicate with out client. If so then please tell me as per sample code of telnet client in arduino can it able to make the connection as given below.

i think you misunderstand what client and server are. these exist on the arduinos and are used to communicate between arduinos (it's not clear to me that you need both or just a client to send and received msgs)

i use esp32 board which support WiFi and open WiFi server to receive messages and a WiFi client to send msgs (when using Linux i would open a socket to do the same thing, so i'm confused about the Arduino approach).

but you are using an Ethernet shield and presumably need an Arduino Ethernet server and client, (see the Arduino Ethernet reference, but i'm confused about their examples)

i strongly recommend finding some example code

in my case, when i connect to a WiFi router, the esp32 is assigned an IP address. in other words the board gets the IP address from the router. i believe the same is true for the Ethernet library.

the next step is to open a connection to an IP application on some other device. to do so, the IP address and "port" number for the application is needed.

there are several ways to do things, which makes things confusing (find some example code)

i have some older code where i have WiFiClient and can use it to write/print msgs or check if a received msg is available() and read() bytes.

in other cases, i have a server with a callback function that processes any received messages. a 3rd way to to check for a new server connection and then start monitoring that.

as mentioned earlier, i believe your first step, since you're using a router is to connect to the router and determine the local IP address of that device, Ethernet.localIp()

once you know the assigned address for each device try to connect to the other arduino using it's IP address and a port you define.
client.connect(), and obtain an IP address.

1 Like
  1. I cannot use esp32 board as that can only connect to wifi or web server(for some security purpose might be we not able to use that). I found the ip of the shield in different way(find after attaching to pc and as Ethernet.localip() not able to give me the ip due to some ip to string conversion error yet i manage to get it). I tried to connect using the same process as i mentioned above (though i have just post here the connection one rest read string and other already given) but that not able to connect.

  2. Please tell me the diagram what i have shared u the last time is the right one?

  3. If i keep the same diagram which i shared in beginning (like adding a client to communicate with ap then how that one is working in case1) . On that diagram if we obsolete the client and just keep it then what the problem. I am trying to stick with that concept as the case 1 was giving perfect output where the case 2 not (though case 2 was also working earlier but not now).

the lower one below

what language do you speak?

perhaps using google translate would make things clearer

Thanks for your prompt reply and clarification. The problem is not language. I can understand clearly what u mean to say. But problem is when i am trying to coding based on the concept given by you it does not worked (i tried the same yesterday). My target is to solve the issue asap. Anyway i can write and speak in English fluently.


The above both diagram are same. Reason behind it is the end arduino+ethernet shield(2) can be placed 20 meter or more distance from the arduino+ethernet sheld1. So for that reason i have to carry the wireless connection (instead of rj 45 cable). The rest of the things are ready only not able to connect the Ethernet to arduino +ethernet shield 2. As tcp connection so i am using 80 even try with 4080 and 8080 but no luck. There is some limitations in that project:

  1. No wired connection can be use from ethernet to arduino as distance between 2 are quite high.
  2. cannot use DHCP (the same one u might be using for esp32) though if no solution found i can try with that also. Even try with that one earlier also but no solution.
  3. Not try to make the connection using web server (as in some cases the web server not available or to keep privacy. so not able to use esp32 though if no solution found i can try with that also) .