user26999: Is there any way to change the default name (ESP_xxxxx) that the module generates?

user28768: Here you are the code where you can see how you can change network name of your ESP8266 working in AP mode:
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>

IPAddress ip(192,168,1,81);         // choose IP address
IPAddress subnet(255,255,255,0);

ESP8266WebServer server(80);

void handleRoot() {
  String page = "<!DOCTYPE html>\n";

  page += "<html>\n<body>\n<h1>Some heading</h1><br>Generated by ESP8266\n</body>\n</html>";
  server.send(200, "text/html", page);
}

// what to do when accessed through http://ip_address/something_undefined
void handleNotFound(){
  String message = "File not found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET)?"GET":"POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i=0; i<server.args(); i++){
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
}

void setup(void){
  Serial.begin(74880);                      // so you can see debug messages automatically sent by ESP8266
  WiFi.mode(WIFI_AP);
  WiFi.softAPConfig(ip, ip, subnet);        // declared as: bool softAPConfig (IPAddress local_ip, IPAddress gateway, IPAddress subnet)
  WiFi.softAP("SOME_NAME", "password", 7);  // network name, network password, wifi channel

  IPAddress myIP = WiFi.softAPIP();
  Serial.println();
  Serial.print("AP IP address: ");
  Serial.println(myIP);

  server.on("/", handleRoot);               // what to do when accessed through browser using http://IP_address

  // what to do when accessed through http://ip_address/test
  server.on("/test", [](){
    server.send(200, "text/plain", "This is another page");
  });

  server.onNotFound(handleNotFound);

  server.begin();
  Serial.println("HTTP server started...");
}

void loop(void){
  server.handleClient();
}


user27157: This line of code should hopefully do a difference.
wifi_station_set_hostname(myHostname);

For more information :
https://www.reddit.com/r/esp8266/comments/3zl3pi/change_esp8266_network_name/

user40661: The function is: WiFi.hostname("Name");, make sure you call it before Wifi.begin()

26999: <p>Is there any way to change the default name (ESP_xxxxx) that the module generates?</p>
 28768: <p>Here you are the code where you can see how you can change <code>network name</code> of your ESP8266 working in AP mode:</p>



<pre class="lang-cpp prettyprint-override"><code>#include &lt;ESP8266WiFi.h&gt;
#include &lt;WiFiClient.h&gt;
#include &lt;ESP8266WebServer.h&gt;

IPAddress ip(192,168,1,81);         // choose IP address
IPAddress subnet(255,255,255,0);

ESP8266WebServer server(80);

void handleRoot() {
  String page = "&lt;!DOCTYPE html&gt;\n";

  page += "&lt;html&gt;\n&lt;body&gt;\n&lt;h1&gt;Some heading&lt;/h1&gt;&lt;br&gt;Generated by ESP8266\n&lt;/body&gt;\n&lt;/html&gt;";
  server.send(200, "text/html", page);
}

// what to do when accessed through http://ip_address/something_undefined
void handleNotFound(){
  String message = "File not found\n\n";
  message += "URI: ";
  message += server.uri();
  message += "\nMethod: ";
  message += (server.method() == HTTP_GET)?"GET":"POST";
  message += "\nArguments: ";
  message += server.args();
  message += "\n";
  for (uint8_t i=0; i&lt;server.args(); i++){
    message += " " + server.argName(i) + ": " + server.arg(i) + "\n";
  }
  server.send(404, "text/plain", message);
}

void setup(void){
  Serial.begin(74880);                      // so you can see debug messages automatically sent by ESP8266
  WiFi.mode(WIFI_AP);
  WiFi.softAPConfig(ip, ip, subnet);        // declared as: bool softAPConfig (IPAddress local_ip, IPAddress gateway, IPAddress subnet)
  WiFi.softAP("SOME_NAME", "password", 7);  // network name, network password, wifi channel

  IPAddress myIP = WiFi.softAPIP();
  Serial.println();
  Serial.print("AP IP address: ");
  Serial.println(myIP);

  server.on("/", handleRoot);               // what to do when accessed through browser using http://IP_address

  // what to do when accessed through http://ip_address/test
  server.on("/test", [](){
    server.send(200, "text/plain", "This is another page");
  });

  server.onNotFound(handleNotFound);

  server.begin();
  Serial.println("HTTP server started...");
}

void loop(void){
  server.handleClient();
}
</code></pre>
 27157: <p>This line of code should hopefully do a difference.</p>

<pre><code>wifi_station_set_hostname(myHostname);
</code></pre>

<p>For more information :</p>

<p><a href="https://www.reddit.com/r/esp8266/comments/3zl3pi/change_esp8266_network_name/" rel="nofollow">https://www.reddit.com/r/esp8266/comments/3zl3pi/change_esp8266_network_name/</a></p>
 40661: <p>The function is: <code>WiFi.hostname("Name");</code>, make sure you call it before <code>Wifi.begin()</code></p>
