java.net.ConnectException - Connection Refused Android Emulator - sockets

I have an android emulator I'm running from eclipse and just trying to connect to a simple socket server I wrote in .NET (c#).
The server is running on the same machine on port 4505. I am able to telnet (through PuTTy) to the server and it works just fine, but when I try to connect to the server with the android emulator I get a: java.net.ConnectException - localhost/127.0.0.1:4505 - Connection refused at org.apache.harmony.luni.net error.
I'm assuming this is because the emulator is on a different subnet or something? If that were the case though I would think I would be getting a different error that would be caught in the UnknownHostException catch block...

According to Emulator Networking IP 10.0.2.2 should be used instead of localhost/127.0.0.1.

I got this figured out. If I use the internal ip it works fine (192.168.1.%) address.
Sorry for the wasted space here but maybe someone else will be able to use this.
the 127.0.0.1 is for the device (emulator) itself.

instead of 'localhost' put your address (192.168.1.%)

Related

Yarn: Error: connect ECONNREFUSED 127.0.0.1:443

When I install ELM via yarn, I get
-- ERROR -----------------------------------------------------------------------
Something went wrong while fetching the following URL:
https://github.com/elm/compiler/releases/download/0.19.1/binary-for-windows-64-bit.gz
It is saying:
Error: connect ECONNREFUSED 127.0.0.1:443
NOTE: You can avoid npm entirely by downloading directly from:
https://github.com/elm/compiler/releases/download/0.19.1/binary-for-windows-64-bit.gz
When I manually browse to https://github.com/elm/compiler/releases/download/0.19.1/binary-for-windows-64-bit.gz. I get
However other people can access the link and it downloads the file.
EDIT:
HOSTS File:
127.0.0.1 view-localhost # view localhost server
127.0.0.1 mydevsnapcap.com www.mydevsnapcap.com app.mydevsnapcap.com internal.mydevsnapcap.com
0.0.0.1 mssplus.mcafee.com
Edit
This use to work a few days ago.
More tests:
I cannot access it from my phone and pc using my fibre connection, but I can access it on both my phone and mobile using my mobile connection.
It turns out that it was my ISP that was for some reason blocking the link. I switch to using the google dns and all is good in the hood: https://developers.google.com/speed/public-dns/docs/using
Something in your computer or on your network is resolving the domain github.com to 127.0.0.1, i.e. localhost. Hence, everytime you attempt this access, it tries to reach a service running on the very same computer you're making the request from.
Check your DNS settings.
Check that there are no entries for github.com in the hosts file (on Windows C:\Windows\System32\drivers\etc\hosts, everywhere else /etc/hosts).
If you're running something like Pi-Hole on your network, check, that it doesn't catch github.com

Genymotion "The connection to the virtual device has been lost.

I have just recently installed Genymotion and VirtualBox on Solus and when I start a virtual device y I get this error:
The connection to the virtual device has been lost.
Please restart the virtual device.
When I start the machine the screen loads but it's all in black and then I get that error.
I googled that and I found that I must reconfigure de Host-only network adapter but unfortunatly it didn't resolve the problem.
I also tried reinstalling virtualbox and genymotion but it didn't solve the problem.
Here's my log file: http://pastebin.com/CsdCJAw3 (I posted it in pastebin because it exceeds the characters limit here)
Thanks in advance
Are you running a VPN client like Cisco Any Connect. I was running it and Genymotion was continuously showing me the same issue. I just had to stop the VPN and close the VPN app if any.
Restart Genymotion and voila it connected.
You can start your VPN after that and it should work.
In case it still doesn't work. After stopping the VPN or if you're not running the VPN client before starting Genymotion try running this command.
This used to help me when something was causing an issue with the virtual box daemon.
sudo /Library/Application\ Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh restart

SQL Developer 4.0.2 connection error 17002 on mac OS X

When I try to create a connection using SQL Developer 4.0.2 on MAC OS I got the following error message :
The Network Adapter could not establish the connection’ (ORA-17002) error.
ORA-17002 is a generic error code shown when the client cannot connect to the database. The actual fix can be found only if we have additional info.
You can start by troubleshooting the following.
1. Check if the database server can be pinged.
2. check if the port is accessible by running telnet.
3. check if there are any firewall rules blocking access to database.
run the below command in mac cli:
sudo scutil --set HostName localhost

How to use RDC with VirtualBox and OSX

I'm trying to do some local RDC testing using VirtualBox. The host is OSX.8, the VM is ubuntu, and VirtualBox is version 4.1.22.
The VM starts fine without any problems. I shut it down and choose "Enable Server" from the Remote Display section of the Display options and start again, and again it starts fine. Note that the port is left default and the authentication is "null".
I start Microsoft's RDC (v2.1.0) and type in 'localhost' and get: You were disconnected from the Windows-based computer because of network problems.
I try 127.0.0.1 and get the same error. Then I type in the IP of my (host) computer and get the same error. I know the loopback address avoids the firewall but I turned it off anyway and got the same error.
I get the same error whether I'm using NAT networking or bridged. What am I doing wrong?
I should note that this is a vanilla install of VirtualBox and I haven't added any extensions or guest additions or anything like that.
Seems I'm doing everything right. What am I missing? Thanks for the help!
Problem Solved! You have to install the "VirtualBox 4.1.22 Oracle VM VirtualBox Extension Pack" (available on the VB download page) to make RDC work. I wish it would tell you this when you click "enable server" but I guess that's asking too much. I hope this helps someone else.

How to connect iphone emulator to selgrid 2?

I have done all the steps listed here to setup a webdriver backed iphone emulator.
I am also able to run my scripts of the emulator when running them locally using the below code while creating my driver instance.
driver = Selenium::WebDriver.for :remote, :url => "http://localhost:3001/wd/hub", :desired_capabilities => :iphone
What I intend to do is connect this emulator to sel grid 2, which has the hub running remotely on a windows machine.
Can some one please share the command to start the selenium webdriver node on the mac machine(coincidentally my local machine).
Some thing like
java -jar selenium-server-standalone-2.21.0.jar -role webdriver -hubHost remotewindowmachine.com -hubPort 4444 -hub http://remotewindowmachine.com:4444/grid/register -host iphoneIP/hub -port 3001 -browser browserName=iphone
which throws an error
Exception in thread "main" java.net.BindException: Selenium is already running on port 3001.
Which seems kind of obvious, but i am confused as to whats to be done about it.
So can someone help me out?
You dont have to run the node registration command to register it in a grid.
The reason for your error
In iPhone(and emulator) when you start iWebDriverApp it starts in port 3001 as remote control. So when you try to start another node in the same machine on same port(3001) its going to throw this error.
The solution
I have not tried it in an emulator, but in the actual device. After installing the iWebDriverApp in your device, you need to set the hub details for the app. This can be done by going to Settings->iWebDriverApp. you will find textboxes to specify Hub URL and the port. Then restart the iWebDriverApp again. Your iphone will be in the grid.