So, I am using telnet to connect to a host and port. But right after I connect the host closes the connection. So, I get the hand-shake of
[SYN]
[SYN,ACK]
[ACK]
Then, I get:
[FIN,ACK]
My question is what is the diagnosis of this type of connection problem?
I am not sure if it connection refused because of the initial hand-shake.
Connection refused? Firewall? Another type of error?
It means the server has closed the connection, which could be for a large number of reasons, including normal operation.
Related
I want to use jdbc to connect Sybase ASE, but, I got an error in the following:
JZ006: 捕获到 IO 例外:java.net.ConnectException: Connection refused: connect
Can anybody tell me how to solve this problem?
"Connection refused: connect" is a low level socket error meaning that nothing is listening on the port you are trying to connect to (or it was blocked by a firewall).
This means that either you have no Sybase ASE running, it is not listening on the IP address you are connecting to, it is listening on a different port, or a firewall blocks your connection.
Why does Apache-Commons-Net's FTPClient sometimes make the wrong computation for the port number in the PORT command? This is in active mode. For example FTPClient it could send out
PORT <some>,<ip>,<address>,<here>,235,181 when in fact the port number used is 60340. What's the cause for this wrong computation?
This could happen on version 3.3.
I know ftpClient.enterLocalPassiveMode(); could solve this, but I want to know the part where the active mode doesn't work as expected.
From your comments, I assume you mistake an FTP control connection with a data connection.
I assume that the 60340 is local port of the FTP control connection. When opening data connection, 60341 is assigned (hence the PORT ...,235,181).
Reasoning: In an FTP active mode, the client opens listening port for the expected data connection, which it then reports to the server via PORT command over an existing control connection. If the server cannot connect to the port, no TCP/IP packet can ever come to that port. As you claim that the "two machines still communicate at port 60340", it must be the control connection. There cannot be any communication on port, if the connection failed ("Can't open data connection").
The actual cause of the "Can't open data connection" error is likely that you are behind a firewall, so the server cannot connect back to the client. What is a common nowadays. That's what passive mode is good for.
I have a client which is intended to connect to a server. For the client, the remote TCP port number is fixed(i.e. 102). I can NOT change it(while I can change the remote IP address). However, the TCP Port number the server is listening on is fixed as well(i.e. 1024) and I can NOT change it too. These two port numbers are different. I want to make the client connect to the server smoothly.
At the first, I had a idea that I setup a proxy listening on localhost:102 and the client connect to 127.0.0.1:102. Then this proxy redirect these TCP traffic to the real address RemoteServerIP:1024. But I found on my windows, there was already a process which is listening on 0.0.0.0:102 and I can NOT change its listening port. So this idea can NOT work.
Thank you very much.
if you cannot do it on the same windows machine running client, why not try to do it on another (linux maybe) machine?
Can I establish more than 1 TCP connections to same server on same port ?
For example :
Connection 1: machine A to Machine B on port 445
Connection 2: machine A to Machine B on port 445
Without terminating previously established connection 1.
If yes, do i need to do any setting to enable such scenario ?
Yes, you can. Without any special setting.
That's exactly what happens when you start, let's say Internet Explorer and Mozilla Firefox and navigate to the same site with both.
Behind the scene to connect to the server, machine A opens a socket using whatever port number and tries to connect to machine B port 445. Machine B, who was listening on port 445 can accept this incoming connection, and uses another socket using whatever other port number to connect it to. In the end, the actual TCP connection is established between whatever port en machine A and whatever port on machine B. On machine B, port 445 is left for listening only (and can accept other connections).
Yes you can, a TCP/IP session is identified by the following 5-tuple:
(src-ip, src-port, dst-ip, dst-port, protocol).
In your case, 4 of the 5 values have to be the same: src-ip (A), dst-ip (B), dst-port (445), protocol (tcp). As such, the src-port still gives you a degree of freedom, by variating this, you can set up multiple sessions. This is what should happen by default, your OS will select a new, unique source port for each connection to the same server.
TCP/IP standard supports this with ephemeral ports. You connect to fixed port on server side, but port on client side is not under your control. TCP/IP stack will choose client port, and connection is then defined and distinguished from other connections with 4 bits of information: client IP address, client port, server IP address, and server port.
I've been trying to get sqlplus to connect to Oracle from my OS X machine. I asked another question about it here.
One person suggested that I try telnet. Consulting the man page, I tried:
[ ethan#gir ~ ]$ telnet DBHOST:1521
Trying xxx.xxx.xxx.xxx...
telnet: connect to address xxx.xxx.xxx.xxx: Operation timed out
telnet: Unable to connect to remote host
Also...
[ ethan#gir ~ ]$ telnet DBHOST 1521
...with same result.
I'm not sure how to interpret these results. Seems like what you'd expect in any case. You wouldn't do this...
$ ssh some_mysql_host:3306
How is telnet to Oracle different?
Or maybe I didn't understand what they meant.
If anyone could help me understand how one uses telnet to test a connection to Oracle I would be grateful.
They're proposing use of telnet simply because it's one of the simplest TCP/IP clients and because it's installed almost everywhere. It's just an easy way to check from the command line whether you're actually able to make a TCP/IP connection to any particular service.
Also, on many of the ASCII based IP protocols it's straight forward to actually interact with the server to check its working by typing in commands and looking at the responses - I've done this numerous times myself with SMTP servers.
In your case, as you're getting a timeout, either the whole host is down, or the access to that particular host or service is being blocked by a firewall. If you can reach the server with a ping then the latter is more likely.
There's also an outside chance that your name resolution is actually taking you to the wrong host, but you should be able to confirm that by looking at the IP address that telnet said it was trying to connect to.
Another common response is "connection refused". That means that the host is up, but that there's no service running on the specified port.
Basically when you specify a port number e.g
Telnet myserver 1521
It will try to connect to the machine on that port. If you see any data returned or even a blank console then it has connected. If you receive an unable to connect message then the machine is not listening on that port or a firewall is blocking the connection.
Your attempt to telnet to dbhost 1521 getting 'unable to connect' with a timeout suggests that either your hostname resolution for 'dbhost' is giving you the wrong answer, or that host is offline, down or you have network problems.
If oracle was working, you'd get a connection. You wouldn't really be able to do anything with it, but it would confirm that oracle was up and listening.
Oracle instance is not connected from other systems, while it is connected from localhost, I think port is not opened and it is showing problem to telnet 1521 port from other system.
Why not do it the 'right' way? Telnetting to some arbitrary network port will not give you correct information, if the database and it's listener is working correctly.
Just install the oracle instantclient software and use the configuration wizard.