Skip to content

Commit

Permalink
Solved the issue below which I also used to observe a long time ago w…
Browse files Browse the repository at this point in the history
…hen I would be doing MQTT testing. Also see this thread below on me instructing other folks on how to solve it on their setups.

ARMmbed/mbed-mqtt#30

Nuertey-Dragonfly-Cellular-LightControl Application - Beginning...

Mbed OS version: 6.15.1

Built: May 27 2022, 07:58:10

Running LEDLightControl::Setup() ...
[00000179ms][INFO][STE1]: power_up: PHY Addr 0 AutoNeg 1
[00000254ms][DBG ][STE1]: MAC Addr 00:80:e1:37:00:25
[00000325ms][INFO][STE1]: ETH buffers : 4 Rx 4 Tx
[00001871ms][INFO][STE1]: PHY ID 7C130
[00001939ms][INFO][STE1]: low_level_init_successful
Connecting to network ...
[00002207ms][INFO][STE1]: emac_link_state_cb set to true
Global IP address set!
Running LEDLightControl::ConnectToSocket() ...
Particular Network Interface IP address: 10.42.0.58
Particular Network Interface Netmask: 255.255.255.0
Particular Network Interface Gateway: 10.42.0.1
Particular Network Interface MAC Address: 00:80:e1:37:00:25
Connecting to "10.42.0.1" as resolved to: "10.42.0.1:7" ...
Error! TCPSocket.connect() to EchoServer returned:                    [-3004] -> "not connected to a network"
  • Loading branch information
nuertey committed May 27, 2022
1 parent 96d9020 commit 026a768
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions LEDLightControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ void LEDLightControl::ConnectToSocket()
// event again should network conditions become better favorable.
return;
}

m_TheSocketAddress.set_port(m_EchoServerPort);

if (m_TheTransportSocketType == TransportSocket_t::TCP)
Expand Down
11 changes: 9 additions & 2 deletions Utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,15 @@ namespace Utilities
// user can choose to specify IP addresses directly in the mbed_app.json
// echo-server-hostname field. This will facilitate testing with
// locally hosted Echo Servers, which by necessity, do not have
// DNS names.
ipAddress.emplace(address.c_str());
// DNS names.

// In which case the following is how we can ensure that the requisite
// SocketAddress object that is normally created during FQDN resolution,
// is manually constructed and propagated back to the User:
SocketAddress tempSockAddress(address.c_str(), 0);
*pTheSocketAddress = tempSockAddress;

ipAddress.emplace(address.c_str());
}
}

Expand Down
2 changes: 1 addition & 1 deletion mbed_app.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"sock-type": "NUERTEY_TCP",
"echo-server-hostname": {
"help": "Echo server host name.",
"value": "\"10.50.10.25\""
"value": "\"10.42.0.1\""
},
"echo-server-port": {
"help": "Echo server port number.",
Expand Down

0 comments on commit 026a768

Please sign in to comment.