Unable to connect to the remote server --->System.Net.Sockets.SocketException:

5,920 views
Skip to first unread message

Harish Kumar

unread,
Jul 26, 2011, 8:08:04 AM7/26/11
to webdriver
what is meant by the Error below?



OpenQA.Selenium.WebDriverException was unhandled
Message="Unexpected error. System.Net.WebException: Unable to
connect to the remote server ---> System.Net.Sockets.SocketException:
Only one usage of each socket address (protocol/network address/port)
is normally permitted 127.0.0.1:7055\r\n at
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot,
SocketAddress socketAddress)\r\n at
System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP)\r\n at
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure,
Socket s4, Socket s6, Socket& socket, IPAddress& address,
ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout,
Exception& exception)\r\n --- End of inner exception stack trace ---
\r\n at System.Net.HttpWebRequest.GetRequestStream(TransportContext&
context)\r\n at System.Net.HttpWebRequest.GetRequestStream()\r\n
at OpenQA.Selenium.Remote.HttpCommandExecutor.Execute(Command
commandToExecute) in c:\\Projects\\WebDriver\\trunk\\dotnet\\src\
\WebDriver\\Remote\\HttpCommandExecutor.cs:line 91\r\n at
OpenQA.Selenium.Firefox.Internal.ExtensionConnection.Execute(Command
commandToExecute) in c:\\Projects\\WebDriver\\trunk\\dotnet\\src\
\WebDriver\\Firefox\\Internal\\ExtensionConnection.cs:line 128\r\n
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(DriverCommand
driverCommandToExecute, Dictionary`2 parameters) in c:\\Projects\
\WebDriver\\trunk\\dotnet\\src\\WebDriver\\Remote\
\RemoteWebDriver.cs:line 795"
Source="WebDriver"
StackTrace:
at
OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response
errorResponse) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver
\Remote\RemoteWebDriver.cs:line 990
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(DriverCommand
driverCommandToExecute, Dictionary`2 parameters) in c:\Projects
\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line
805
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String
mechanism, String value) in c:\Projects\WebDriver\trunk\dotnet\src
\WebDriver\Remote\RemoteWebDriver.cs:line 836
at
OpenQA.Selenium.Remote.RemoteWebDriver.FindElementByXPath(String
xpath) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote
\RemoteWebDriver.cs:line 640
at
OpenQA.Selenium.By.<>c__DisplayClasse.<XPath>b__c(ISearchContext
context) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver
\By.cs:line 119
at OpenQA.Selenium.By.FindElement(ISearchContext context) in c:
\Projects\WebDriver\trunk\dotnet\src\WebDriver\By.cs:line 227
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by) in
c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote
\RemoteWebDriver.cs:line 289
at AsiaRooms.Program.Main(String[] args) in D:\Projects
\AsiaRooms\AsiaRooms\Program.cs:line 34
at System.AppDomain._nExecuteAssembly(Assembly assembly,
String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile,
Evidence assemblySecurity, String[] args)
at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

darrell

unread,
Jul 27, 2011, 9:14:17 AM7/27/11
to webdriver
The key is in the message, "Only one usage of each socket address
(protocol/network address/port) is normally permitted 127.0.0.1:7055".
This implies that something is using "localhost:7055". Possibilities:

* You are running the test suite twice
* You are not releasing the connection after each run
* The test suite crashed and is still running in the background
* Something else is running on your computer and using that port

By the \r\n, dotnet and C:\ references in the error message, you are
running on Windows. On Windows, netstat will show you which ports are
in use. A 'netstat -b' should help you determine which application is
using port 7055.

Darrell

Daniel Wagner-Hall

unread,
Jul 28, 2011, 5:21:09 AM7/28/11
to webd...@googlegroups.com
How long is the test trying to run before throwing this exception? How
many tests are you running in parallel?

We bind to socket 7055 as a lock, to make sure that only one
FirefoxDriver starts up at the same time (note that they can run at
the same time, but when they're actually launching, we need them to
not do so in parallel). This sounds like either
* For some reason, we're not releasing one of those connections, and
the second attempt to connect is timing out (probably after about 60
seconds)
* You're trying to launch many FirefoxDrivers at once, and running in
to unlucky timings

Also, are you calling IWebDriver.Quit() when you are done with each
instance (as opposed to Close(), or leaving them open)?

> --
> You received this message because you are subscribed to the Google Groups "webdriver" group.
> To post to this group, send email to webd...@googlegroups.com.
> To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages