request.getRemoteAddr(); returns 127.0.0.1 in jboss6 and in wildfly10 it returns actual remote ip - jboss6.x

I am migrating jboss6 to wildfly10, somewhere in code i am checking request.getRemoteAddr(); in jboss6 it returns 127.0.0.1, but in wildfly10 it returns the actual remote ip of client. But i want to know the logic behind that, or achive the same in wildfly10.
Thanks
Pavan

Related

Finding server in LAN

How to find, in python, server without having it's IP in LAN?
I assume that port will be configured in file so its doesn't have to find port. I tried to search on google but I couldn't find anything useful or that could help me with it.
The server IP will be changing because it will not run constantly on the same computer.
So basically I got app with server that is on random computer in network, and I want to find its IP from another computer.
I would be really thankful for either explanation how to do it or link that could help me to do it.
Not certain if this is what you want to do, I think you want to find the IP of a server by running some python execution on the server?
You could try :
from subprocess import call
call (["ipconfig"])
This will dump the IP config and you can parse out the IP address. This assumes a windows server. You would have to modify the call for your OS.
Updated :
Check this out : TCP Communications or UDP Communications ... it looks like what you are looking for. You will still have the mess of determining the available addresses on the network (arp -a), and testing each one - this would be your client side app. Your server side app, when it receives the right query on the TCP or UDP port, would then determine it's address (ipconfig) and return the value.

Modify pg_hba.conf file to allow me access

I keep getting an error when trying to connect to psql database, "connection closed by remote host". I have tried modifying the pg_hba.conf file to allow the IP of my computer to have access, but I still get the same error, what am I doing wrong? Do I have to restart the server or something?
host all all <ip>/32 md5
As well, I have seen /24 instead of /32, how do I know which number to use?
The notation "/32" refers to a single IP address whereas the notation "192.168.1.0/24" refers to all addresses on the 192.168.1.x network.
And yes, you will probably have to do an SQL restart, something like:
service postmaster restart
But make sure your IP address is restrictive so that hackers won't be visiting your database all day. Use "localhost" if you can (127.0.0.1).

grunt-connect not working when host is 0.0.0.0

I'm trying to externally access my local node.js development server that's created using the grunt-contrib-connect plugin. The server works (locally) when I use localhost or 127.0.0.1 as the hostname parameter. However, when I change the parameter to * or 0.0.0.0 in order to allow external access (as specified in the documentation), I cannot access the server either locally or externally; this is the error I get in Chrome:
I've tried disabling my firewall and I can see packets coming in from my phone on the correct port (which I'm using to attempt to access my local server externally).
Any ideas why it doesn't work to use * or 0.0.0.0 as the hostname?
Figured it out - when I specified * or 0.0.0.0 as the hostname parameter, I was able to connect externally - I just hadn't tried since I wasn't able to access it locally and assumed it wasn't working at all. Changing the address in the browser to localhost:9000 (instead of 0.0.0.0:9000, which it defaults to) when Grunt first opens the page allowed me to access my server locally.
You can set your own ip address instead of the 0.0.0.0.
With this grunt launch the server on your ip. You can use your mobile to.
The livereload will work on your desktop and on your mobile.
It's not the best way if your work by team because each one have his ip address but it's good enough if you work alone.

Does accept function return error(-1) if TCP server goes out of network

Does the accept function returns error(-1) if the Ethernet interface it is attached goes out of network?if not how does the application(TCP server) will know that its interface is not active any more ??
I am using one thread for accepting the connection and not using any "select" statement for doing so.Directly calling accept() function but somehow it is not retuning error if I remove the IP address from Ethernet interface.
using C and working environment is linux.
Usually you don't bind your server socket to a specific IP address (you use INADDR_ANY). So even if you remove your ethernet IP address, you could still contact your server using the loopback interface. Or some other interface with an IP address.
If you want to make sure that your server is reachable from the net, checking the interface status does not get you much. It's just a single hop on a long path through the network. You'd need a testing client somewhere else to check the reachability of your server.

Getting Started with CouchDB

I've got CouchDB installed on my linux cloud server and I'm trying to access the "Futon Welcome Screen". The O'Reilly book says to go to "127.0.0.1:portnum", but I'm not working on localhost, it is my remote server, so I should be able to use "xxx.xxx.xxx.x:portnum" (my remote address) to access Futon right? This is not working, do I need a virtual host or something? Thanks.
Go to your local.ini file. (probably in /etc/couchdb) and set bind_address to either 0.0.0.0 (ie. respond to all IP addresses) or specify another IP address that you're either using in your LAN (private) or over the internet. (public)

Resources