I am building a basic client server application in delphi indy 10 ;
I have set sever app with local ip and a specific port, and i set client with public
IP to client host when i am testing the application the following error i got
here
I am testing both client and server app in same machine (as i had no other option),will this cause error.
You can absolutely run a TCP client and server on the same computer.
Only one application can listen on a given port at a time, but (virtually) any number of clients can connect to that server, even from the same machine.
Did you find your router settings from the previous question?
Related
I currently have a Firebird 2.5 database at a client premises, installed on a Windows 7 Pro machine (32 bit), that has multiple stations in their local network that can connect to the database, along with the local machine being able to connect with our application and IBExpert.
However, for some of our software packages, a remote connection is required (outside of the local network). This previously was working but no longer works.
When I connect with FlameRobin from my office (I'm located in a different city / different network), I receive the following error message:
IBPP::SQLException
Context: Database::Connect
Message: isc_attach_database failed
SQL Message: -923
Connection not established
Engine Code : 335544421
Engine Message :
connection rejected by remote interface.
Performing this connection attempt with IBExpert, both from my office and from other external networks fail with a same message.
However, I am getting TCP/IP communication from what I can see. Here are the details of my troubleshooting steps for the last week:
Originally, I was receiving the following error when connecting from outside the network:
"Connection not established
Connection refused by remote interface"
Since that time, we have done a restart of the router and now have the current "connection rejected by remote interface." error message.
I can telnet to the public IP through port 3050 from my office and other outside networks.
I tested port 3050 on sites like YouGetSignal.com or CanYouSeeMe.org and they appear as open.
Other ports that we communicate on publicly are open and communicating.
The site has Kaspersky antivirus installed but all tests to connect via IBExpert while Kaspersky was in sleep mode behaved the same.
Installation of Firebird 2.5 to another workstation in the same local network, pointing to port 3051 (both in Firebird.conf and in the Windows Firewall and Router) show up as being open through Telnet and CanYouSeeMe.org but again, cannot be communicated on from outside via port 3051.
IBExpert works from a workstation in the network to the server
The server currently has no entry for RemoteBindAddress in the Firebird.conf
Wireshark shows that when a connecting from outside, there are packets coming through.
The TCP/IP test in IBexpert under Communication Diagnostics for the public IP as the host and the Service show the following Test Results:
Attempt connecting to XX.YY.ZZ.AAA.
Socket for connection obtained.
Found service 'GDS_DB' at port '3050'
Connection established to host 'XX.YY.ZZ.AAA',
on port 3050.
TCP/IP Communication Test Passed!
Database path, username, and password have all been checked multiple times.
locally on the server, I've changed security of the database.FDB and the security2.FDB to have Everyone, Full Control
At this point, we have a scheduled restart of the ISP's modem happening soon, although the fact that we have full TCP/IP communication over the port makes me doubtful that this is the issue.
If anyone can lead me down any recommended next steps to debug or to any tools that are available to help in this situation, that would be greatly appreciated.
This turns out to be a networking issue. We performed the following tests:
We performed a power cycle on the ISP's modem which showed no change in behavior
We connected a laptop directly to the ISP's modem but couldn't communicate to FB even with proper port forwarding rules in place on the machine and firewall.
We ran wireshark on both sides and on connection attempts, we found many attempts to connect with retransmissions that failed.
The technical team at the client side decided to install a VPN capable router and now we're good to go. From what we found there may be some kind of ISP blocking occurring as many of the tech teams remote services were failing to connect with similar behavior.
Hopefully this post helps people in the future with remote connectivity debugging, and all of the places you can look at when you're running into this problem.
I'm trying to run a socket connection from my iOS app to a bespoke server.
The iOS communicates via UDP to the server on port 12345. The request needs to come from socket 54321 on the device.
How do I open up a socket connection on iOS that communicates to a server on one port but listens via a different port.
I have followed the example on:
https://www.raywenderlich.com/3932/networking-tutorial-for-ios-how-to-create-a-socket-based-iphone-app-and-server
But this does not cover the local port
I have also looked at the documentation on https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/UsingSocketsandSocketStreams.html but I am finding it unclear due to my limited knowledge of socket connections.
I am currently attempting to use https://github.com/robbiehanson/CocoaAsyncSocket/wiki/Reference_GCDAsyncSocket
But I don't seem to be able to control the local port.
Thanks in advance
Normally you don't care about the sending socket, but when you create your AsyncUDPSocket you can use bindToPort: to set its port. Then use sendData:toHost:port:timeout:tag: to send the data
I have following script to get given file from given remote directory by accepting following parameters
Host Name that you are connecting to get File
User Name of the Host
Local Directory where you wanted to transfer file
Remote Directory from where you wanted to get file
File name that you wanted to get from Remote server
FSERVER=$1
FUSER=$2
SRC_DIR=$3
REMOTE_SRC_DIR=$4
FILE_NAME=$5
cd $SRC_DIR
sftp $FUSER#$FSERVER <<GOTO
cd $REMOTE_SRC_DIR
ascii
get $FILE_NAME
bye
To access the files from $REMOTE_SRC_DIR to SRC_DIR do I need port open from both side? I.e. bi-directional or just one port from Remote Server to Source and it should need "INITIATE" session from the source. And what is the reason?
As per my understanding we are connecting to remote server path and then writing the query Get File name. So we need to bi-directional access.
SFTP uses a single TCP connection. In general, TCP connection is stateful. As such, once opened both sides can send data to each other. Only the passive side of the connection needs to initially have a well known port number opened (22 for SSH/SFTP in this case). The active side opens a random port number that the passive side learns from the TCP connection initiation packed. This passive-side port closes with the TCP connection. While the active-side port is kept open for future TCP connections.
The SFTP protocol uses strictly request-response model. I.e. although the TCP allows both sides to send data anytime, with the SFTP, the server never sends data on its own, but always in a response to client request. Note that this does not mean, that no unsolicited data flows from the server to the client on network level, as in both underlying protocols of the SFTP (the TCP and the SSH) both sides of connection can send (and send) packets anytime.
Simplified flow is:
SFTP client initiates TCP connection to remote port 22 (this causes implicit open of random local port on client side, this is done by operating system).
SSH protocol initialization and authentication occurs.
SFTP client requests SSH server to start SFTP server. Note that SFTP server is not a continuously running process. It is a sub-process/sub-service of SSH server, which is continuously running (=listening on port 22)
SFTP protocol initialization occurs.
SFTP (contrary to FTP protocol) is stateless, as such it does not have a concept of a working directory. As such changing remote working directory with the cd command is simulated on client side. The SFTP server is not aware at all of client remote working directory. SFTP client typically only verifies existence of the new working directory with the SFTP server.
The ascii command: The OpenSSH sftp client does not have ascii command. You should get "Invalid command." Unless you use other client than OpenSSH.
The get command: For file transfers the SFTP protocol offers a similar block-level API as most operating systems (contrary to a stream API of FTP protocol). So SFTP client sends "open file" request, over the existing connection, followed by repetitive "read block" requests and "close file" request. As with any SFTP requests, responses go back over the same TCP connection.
At the end, the TCP connection is terminated and connection-specific random local port is closed.
I am using Mac book and having client and server running on same machine. Server opens socket whenever it has to send command to Client. Problem is Client opens socket at startup but whenever server opens on . Ip adress is different. I would like to know if i create tunnel between these 2 sockets. Right now, while in server i am getting "Connection refused" error.
Any help is appreciated.
Thanks
Just use 127.0.0.1 loopback address for testing your initial socket code. Server bind()s and listen()s on some known port, client connect()s to it. Once you figure out that setup you can move on to routing between real addresses.
I know this question is too broad to answer, but I can't connect to a filezilla server I'm hosting.
The computer its on has a real IP address (not not).
I am allowing connections on ports 21 and 22.
I can connect from a local filezilla client over both ftp (mapped to port 21) and ftps (mapped to port 22).
Whenever I try to connect from another computer, nothing happens.
When I connect to a website hosted on the same computer (over http or https) the connection works fine.
The client just hangs and the server doesn't print any new lines, as if it has detected no connection at all.
How can I debug this problem? It seems too broad to really ask about, so how do I go about testing to improve the situation?
try telneting to the port :
telnet HOST 21
if you get any response, it should be from a ftp server.