Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I have a conceptual question.
If I have a Java socket (this socket stablish a TCP connection by a channel)
If I run a nc command, the nc command open a tcp connection, then the nc can affect my socket
The same question with telnet, is possible that the telnet affect my socket connection?
Not normally. The operating system will keep those sockets separate. You won't easily affect one socket from another.
If your Java application uses local port 10001 to connect to an HTTPS server on port 443, that socket would be dedicated to that connection between those IPs and ports. IF netcat from the same machine connected to the same server on 443, it wouldn't use the same local ports, and they would not be the same socket.
Now, in unixland at least, open sockets are just file descriptors, and those can be passed between programs. So, for example, your Java application can spawn a new thread and hand the open socket to the thread. But an independent process on the system can't easily just nab data from the open socket.
Of course, these limitations are merely enforced in software, not physical laws, so "anything is possible". But operating systems are going to try to stop this kind of thing from happening.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I currently have a setup where I got a raspberry pi connected WIRELESSLY to a router and a WIRED desktop connected to the raspberry pi (via Ethernet) and receiving internet from the pi. On the Desktop I want to run a Minecraft server on port 2000, however, I believe that because of my setup this port can only be seen by the PI alone and any not the router and anything else connected to the router. I currently have the PI ITSELF port-forwarded on the router for port 4300, I just need some way to link the pi's wireless connection of port 192.168.1.55:4300 to the shared Ethernet connection of port 192.168.220.78:2000.
I've looked into messing around with the IPTABLES in Rasbian Linux but I don't fully understand them.
My ultimate goal is to let this server be accessible to anyone outside of my home.
I found the problem, apparently, I needed to accept the incoming connections on the server's computer. So on the same computer as the minecraft server I ran: sudo iptables -A INPUT -p tcp --dport 2000 -j ACCEPT
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 5 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
I have a small sample application which send some data to the server and close the connection afterwards. I ran it on my localhost as server & client and it worked.
When I ran the same code after changing the IP to another host(running Cent OS in VM) as server and my client (Ubuntu), I get the following error from client binary.
client.c : 47 Error connection to remote machine
139915881411416:error:02002071:system library:connect:No route to host:bss_conn.c:246:host=192.168.56.101:6001
139915881411416:error:20073067:BIO routines:CONN_STATE:connect error:bss_conn.c:249:
I am able to ping the remote server from my terminal. Any suggestions or solutions are welcome :) .
Actually the problem was because of firewall running on server(Cent OS). After stopping the firewall using command,
service iptables stop
the client was able to make a connection with the server.
Better Solution (without stopping firewall):
Add your client's IP address in the iptables so that it will allow the client to connect to your server without stopping firewall.
iptables -I INPUT -s <client_ip_address> -j ACCEPT
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I installed Ubuntu server 16.04 on one of my computer to setup a web server. I want to install Phabricator to manage a video game project with some friends. I'm trying to configure my router (Home Hub 1000 from Bell) to redirect port 80 to this server. The problem is that it doesn't work at all. I can access to my web page from a computer on my local network with the name of the computer, but not from the outside using my IP address (the one used by my router). I added my server to DMZ and I had set up a port forwarding (Protocol: Both, Internal port: 80, External port: 80). My server use a reserved IP address configured on my router.
Thanks for your help.
Besides of a reserved local ip-address, it is useful to have a static ip-address from your provider(because they might change your ip once and a while). You can find your ip on whatismyip.com
When both port forwarding and DMZ are configured in your router, you can look if there is firewall on your server which blocks the external requests.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 7 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I have a HTTP enabled device on my local network that listens at let's say 192.168.1.32:9427. What's the simplest way to make public access to that socket?
you need to port forward from public ip address to private ip-address on port no. 9427
example:
public ip : 20.20.20.20
private ip : 192.168.1.32
Now when someone try to access your local http server should access via 20.20.20.20:9427
to do that :
you need to enable that on your adsl modem or on your router device
to do that for your adsl modem from here
How to Port Forward Your Router
check open ports to see if port no. 9427 is opened or not
Open Port Check Tool
you need to allow your iptables if you are using linux machine and allow port no. 9427
to do that :
iptables -I INPUT 1 -p --dport 9427 -s -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
So I was looking into what port dropbox uses on my computer and tried to see what would happen if i created a new http server on that port. Surprisingly it worked. So both dropbox and my http server were running on the same port, but the incoming requests were routed to the different application depending on the source address.
lsof -i tcp:51311
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Dropbox 3811 user 18u IPv4 0xdedc291239eb197f 0t0 TCP 172.20.10.2:51311->108.160.163.34:http (ESTABLISHED)
node 3984 user 11u IPv4 0xdedc29123b1494cf 0t0 TCP *:51311 (LISTEN)
I am wondering how this works. I thought the os would refuse the bind my http server since the port was already alloted to dropbox but to my surprise it worked. Anyone thoughts?
TCP sockets match against the 4-tuple (source-ip, source-port, destination-ip, destination-port). As long as all four of them don't clash, you can have port reuse.
As long as your daemon doesn't receive a connection from 108.160.163.34:80 your stack can handle it. If the server 108.160.163.34 is well-behaved it won't let an application initiate a connection to your socket (172.20.10.2:51311) with 80 as source port. (bind() should fail with Address already in use).
If it isn't well behaved, the existing dropbox connection will receive an unexpected packet (wrong sequence number space) and your stack will RST it.
The HTTP port being used by Dropbox is at 108.160.263.34, not your local host.
Port 51311 is being used as one outbound port and one listening port. Not 'two services running on the same port'. Otherwise there would be two LISTENING lines.