Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Loop interface (127.0.0.1) #6437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
igvassor-git opened this issue Aug 23, 2019 · 3 comments
Closed

Loop interface (127.0.0.1) #6437

igvassor-git opened this issue Aug 23, 2019 · 3 comments

Comments

@igvassor-git
Copy link

I have the Arduino IDE 1.8.9 and the core 2.5.2.
I want to connect a local client and a local server:

WiFiServer Nserver(2222);
WiFiClient Wclient;
.....
Nserver.begin();
.....
if(!Nclient.connected())
{
int T;
T = Nclient.connect(IPAddress(127,0,0,1),2222);
Console_write(String(T));
}
else
{
Console_write("Connected");
}
....

To do this, I set the following in the file ..\Arduino15\packages\esp8266\hardware\esp8266\2.5.2\tools\sdk\lwip2\include\lwipopts.h :

/*

  • LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP
  • address equal to the netif IP address, looping them back up the stack.
    */
    #if !defined LWIP_NETIF_LOOPBACK || defined DOXYGEN
    #define LWIP_NETIF_LOOPBACK 1
    #endif

The core was recompiled successfully.
But the connection between the client and server is not established.
Non-local the client connections are successful.
Non-local the server connections are established successfully.
Where am I mistaken?
Please help me.

@devyte
Copy link
Collaborator

devyte commented Aug 23, 2019

@d-a-v is the expert here.

The lwip2 libs are included precompiled with the core. That means that just changing lwipopts won't have an effect on the core rebuild. You have to first recompile lwip2 with your changes (there's a readme), then make sure the newly built libs made it to the core replacing the originally included ones (I'm not sure if they get copied over automatically, or you need make install, or manual cp over). And only then rebuild the core.

Be aware that the localhost interface is disabled on purpose, because it hasn't been tested. That means that enabling it could work. Or it could cause current wifi functionality to break. Or something else.

Closing since this isn't a core issue.

@devyte devyte closed this as completed Aug 23, 2019
@devyte
Copy link
Collaborator

devyte commented Aug 23, 2019

BTW, if you do get it to work, we'd love to hear about what you did and how it behaves. I'm thinking of a mini writeup for other users who could want to follow your footsteps.

@igvassor-git
Copy link
Author

Thank. I will try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants