cell phone to ESP32 WiFi question

I am using an example where the ESP32 is set up as a web server at address 192.168.1.49. I have entered my local wifi name and password into the example program. On my cell phone, I use a browser to surf to this address and it works.

My question is, do I really need a router for this transaction. Does the cell phone go directly to the ESP32?

Also, I can access the ESP32 using my PC by surfing to this address also but I know that my PC is connected to he router. So even though the PC is connected to the router, the router must "pass through" the request it seems, yes?

I am wondering if the port makes any difference.

If you just want a local, private network, you can ditch your router and setup the ESP32 as the router. However without additional work, you won't have access to the internet.

Actually, what I think I want is to use sockets. I do not want router functionality at all. Seems like you could merely set the ip address of one ESP to something lioke 192.168.1.4, and set the ip address of the other ESP to say 192.168.1.5 and then communicate between them using a common port of any number.

I would then have both ESPs waiting for a connection and when one of the other ESPs wanted to send a message it would just sent to the others IP address and port number.

Where am I wrong. Can this be done? Any examples?

You could set one of the ESP's in AP-mode and the other in STA mode (actually they can be in both modes at the same time but let's keep it simple) then the STA connects to the AP, the AP defaults to 192.168.4.1 and it will dynamically assign 192.168.4.2 to the first connection as default (you can still connect with a static IP if you wish.