Error : A new session could not be created, Cannot bind to socket

Hi,
While launching the application via appium, i am getting the following error message. Please find the error log below :-

info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:"A new session could not be created. (Original error: Command failed: error: cannot bind to socket\r\n)",“killed”:false,“code”:1,“signal”:null,“origValue”:“Command failed: error: cannot bind to socket\r\n”},“sessionId”:null}

info: e[37m<-- POST /wd/hub/session e[39me[31m500e[39me[90m 27487.802 ms - 256e[39m e[90me[39m

Thanks in advance.

Is it possible you’re trying to use a portal that is in use, or below 1024?

Hi
Curently i am using port 4723. May i know what do you mean by ‘the portal that is in use’

Oops, typo. I meant a port that is in use.

Hello All,
I am also facing a similar issue. I am trying to run the appium server through java code but facing an error : “Failed to start an Appium session, err was: Error: Command failed: error: cannot bind to socket
error: cannot bind to socket”

I am using the following JAVA code to start the appium server:

CommandLine command = new CommandLine(“cmd”);
command.addArgument("/c");
command.addArgument(“C:/AppiumForWindows-1.3.4.1/Appium/node.exe”);
command.addArgument(“C:/AppiumForWindows-1.3.4.1/Appium/node_modules/appium/bin/appium.js”);
command.addArgument("–address");
command.addArgument(“127.0.0.1”);
command.addArgument("–port");
command.addArgument(“4724”);
command.addArgument("–no-reset");
command.addArgument("–log");
command.addArgument(“D:/appiumLogs.txt”);
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(1);

Exception is thrown while instantiating Appium driver.
Please help!!

Try changing the port. Also make sure that you dont have anything else running on 8080

Hi,
This issue is now resolved. But I am now facing another issue while running appium version 1.4 using the commands mentioned in my previous reply.
This is the error log that i receive while executing the code for Appium 1.4 version:

TypeError: Object function parseUrl(req){
var parsed = req._parsedUrl

if (fresh(req, parsed)) {
return parsed
}

parsed = fastparse(req.url)

if (parsed.auth && !parsed.protocol && parsed.href.indexOf(’//’) !== -1) {
// This parses pathnames, and a strange pathname like //r@e should work
parsed = fastparse(req.url.replace(/@/g, ‘%40’))
}

return req._parsedUrl = parsed
} has no method 'original’
at serveStatic (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\node_modules\serve-static\index.js:63:32)
at Layer.handle [as handle_request] (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5)
at trim_prefix (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\index.js:302:13)
at C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\index.js:270:7
at Function.proto.process_params (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\index.js:321:12)
at next (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\index.js:261:10)
at favicon (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\serve-favicon\index.js:63:7)
at Layer.handle [as handle_request] (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5)
at trim_prefix (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\index.js:302:13)
at C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\index.js:270:7
at Function.proto.process_params (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\index.js:321:12)
at next (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\index.js:261:10)
at logger (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\morgan\index.js:136:5)
at Layer.handle [as handle_request] (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5)
at trim_prefix (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\index.js:302:13)
at C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\index.js:270:7
at Function.proto.process_params (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\index.js:321:12)
at next (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\index.js:261:10)
at b (domain.js:183:18)
at Domain.run (domain.js:123:23)
at C:\Xmatters_Checkout\Appium\node_modules\appium\lib\server\helpers.js:326:15
at Layer.handle [as handle_request] (C:\Xmatters_Checkout\Appium\node_modules\appium\node_modules\express\lib\router\layer.js:82:5)
FAILED CONFIGURATION: @BeforeMethod loadLoginPage
org.openqa.selenium.WebDriverException: ERROR running Appium command: Object function parseUrl(req){
var parsed = req._parsedUrl

if (fresh(req, parsed)) {
return parsed
}

parsed = fastparse(req.url)

if (parsed.auth && !parsed.protocol && parsed.href.indexOf(’//’) !== -1) {
// This parses pathnames, and a strange pathname like //r@e should work
parsed = fastparse(req.url.replace(/@/g, ‘%40’))
}

return req._parsedUrl = parsed
} has no method 'original’

I had tried to debug and found that no such method ‘original’ exists index.js file.
NOTE: This issue does not exist with Appium ver 1.3.4.

Please guide!!

Run with the latest version of npm. Also make sure that there is no change in your code. If it is successfull in 1.3 then it should do in 1.4 too.