Firebird remote connection failure - c++

I have a C++ application that used to read the data from the Firebird SQL server.
when I changed port from 3050 to 3053 it shows error like
DB Error : 0 : Unable to complete network request to host "192.168.1.47".
Failed to establish a connection.
unknown Win32 error 10060
Invalid connection string attribute
conf file is changed like
# Type: string, integer
#
RemoteServiceName = gds_db
RemoteServicePort = 3053
Fb connection string is
Driver=Firebird/InterBase(r) driver;DBNAME=192.168.1.47:CWNPFB;PORT=3053;UID=SYSDBA;PWD=********
Is there any modification is required to solve this? Application can read the data if the port is 3050.

The problem is with your connection string:
You need to
Remove PORT=3053 from the connection string (this causes the "Invalid connection string attribute" message)
Modify DBNAME=192.168.1.47:CWNPFB to DBNAME=192.168.1.47/3053:CWNPFB (to specify the right port)
You might also want to comment out (or remove) the line RemoteServiceName = gds_db, because you are now instructing Firebird to listen on gds_db (== port 3050), and not on port 3053. I believe it usually listens on the last one configured in the config file, but I'm not sure that is always the case.

Is your firewall configuration correct for port 3053? Another service may runs on this special port.
You could do the following steps.
Try to run the application on the database server, please change the IP to 127.0.0.1 or localhost.
If step (1) works: check out the firewall
If step (1) doesn't work: maybe try another port, check whether Firebird is running

Related

AzerothCore Unable to connect to server, probably WorldSocket Malformed request sent by client

I am using AzerothCore locally and when I try to log in - I am stuck at "Authenticating".
Previously on login attempt - a error occured, WorldSocket Malformed request sent by client, But after opening the ports for both inbound and outbound connections - it dissapeared.
Therefore, no error message, just stuck at "Authenticating".
Client version: 3.3.5 (13240) (Release)
Jan 24 2010
The realmList is changed to 127.0.0.1:8085 But I am not sure if it is correct, since once I had issues accessing localhost on another application and had to use the router's IP (192.168.0.3)
WorldSocket Malformed request sent by client
WorldSocket::ReadHeaderHandler(): client 111.222.11.22 sent malformed packet (size: 1234, cmd: 3333333)
means some machine anywhere on the planet sent a random portscan to your IP.
Not related to your actual problem.
You should try and set the realmlist to the LAN IP of the machine running the server and do the same in the realmlist table.
Also make sure all ports are properly forwarded to your server. (8085 und 3724 by default).
If both, client and server are running on the same machine, you can use 127.0.0.1. Not otherwise.
Solved:
On the client, use set realmlist 127.0.0.1
Without the port

Connect to DBus service via TCP

I'm new in work with interprocess communication. I need you help and clear explanation. I have 2 applications. One of them is a service and one is a client. I've used QT/C++ to write them. When they are working on the one local PC - all is good. But I need to separate them.
So, I have a service on the PC with IP 192.30.82.101.
I connect it to bus using next code:
QDBusConnection connection = QDBusConnection::sessionBus();
connection.registerObject("/my/service/MyService", mySvc);
connection.registerService("my.service.MyService");
Also I have a client on the another PC with IP 192.30.82.40.
I connect my client using the next code:
QDBusServiceWatcher serviceWatcher = new QDBusServiceWatcher();
serviceWatcher->setConnection(QDBusConnection::sessionBus());
serviceWatcher->addWatchedService("my.service.MyService");
.....
myServiceProxy = new local::MyService("my.service.MyService",
"/my/service/MyService", QDBusConnection::sessionBus(), this);
I need to connect my client on the PC with IP 192.30.82.40 to the service on the PC 192.30.82.101. I don't know how to do this. I've found a few topics on the forum but I still don't understand what to do.
So, what I have found:
On the PC where is my service I have to add additional lines to /etc/dbus-1/session.conf:
<listen>tcp:host=<host>,port=<port></listen>
<listen>unix:tmpdir=/tmp</listen>
<auth>ANONYMOUS</auth>
<allow_anonymous/>
Here I have a question: Which IP address I have to use here (server or client)? Which port is used for DBUS (is it default port or how I can check it)? I have tried to set an IP address of my client PC, my service PC and different ports, and port 0, but I've got an error: Failed to bind socket "172.30.82.40:0": Cannot assign requested address.
On the client side I have to set DBUS_SESSION_BUS_ADDRESS with the same address: export DBUS_SESSION_BUS_ADDRESS=tcp:host=<host>,port=<port>.
I've tried to do this with different ports, with 0 port, because this means - use any free port. But I cannot start bus daemon with any port+IP configuration.
Also I've tried to connect client QDBusServiceWatcher to bus using the next code:
serviceWatcher->setConnection(QDBusConnection::connectToBus("tcp:host=<host>,port=<port>", "session"));
It was not successful.
I have no idea how to connect them to each other.
Can anybody, please, explain me how it should be, how does it work?
I want to clearly understanding how does it work?
I will be very grateful for any help. I hope for your kindness.
UPDATE
I have found how to connect my client to DBus bus via TCP:
On the PC where is my service I have to add additional lines to /etc/dbus-1/session.conf:
<listen>tcp:host=localhost,bind=*,port=6667,family=ipv4</listen>
<listen>unix:tmpdir=/tmp</listen>
<auth>ANONYMOUS</auth>
<allow_anonymous/>
Here we should add PORT. We can find it in dbus config file.
On the client side I have to set DBUS_SESSION_BUS_ADDRESS with corresponding address (IP of PC where is service):
export DBUS_SESSION_BUS_ADDRESS=tcp:host=192.50.88.10,port=6667,family=ipv4.
Thats all. We can check it just started dbus-monitor.
But now I have another issue: how to connect my client to my service?
I need to do something more to connect to my service.
I guess that this is something like:
QDBusConnection::connectToBus("tcp:host=<host>,port=<port>","connectionName");
I've tried to connect with any random name, but this is not correct.
So, my question is - where I can get correct connection name?
Correct answer to my question is:
On the PC where is one application add additional lines to
/etc/dbus-1/session.conf:
<listen>tcp:host=localhost,bind=*,port=6667,family=ipv4</listen>
<listen>unix:tmpdir=/tmp</listen>
<auth>ANONYMOUS</auth>
<allow_anonymous/>
Correct port you can find in dbus config file.
On the client side It's needed to set DBUS_SESSION_BUS_ADDRESS with
corresponding address (IP of PC where is service):
export DBUS_SESSION_BUS_ADDRESS=tcp:host=192.50.88.10,port=6667,family=ipv4.
To connect to session where is alive your remote app use the next
connection string:
DBusConnection::connectToBus("tcp:host=192.50.88.10,port=6667", "qt_default_session_bus"));
How to know session name? I've added log in my service:
qDebug() << "Connection name: " << connection.name();
Then started app, copy printed name and set it in my client.
Now it works!

MySQL server not accepting remote connections

I'm using the C++ connector and one of the example code that goes along with it and it wont allow external connections to connect to my database when i change the host address from localhost to my computer's address where the server is running.
This connects perfectly without any problems:
con = driver->connect("tcp://127.0.0.1:3306", "Shawn", "my_pass");
But obviously this wont work when i change computers, so i set the host address to my computer where the server is running like this:
con = driver->connect("tcp://108.xxx.xxx.xxx:3306", "Shawn", "my_pass");
*x's stand for numbers to hide my IP
Why won't it connect?
I allowed Norton 360(takes over windows firewall) to accept any and all connections and ports from my program.
I gave the user "Shawn" the privledges necessary to accept all hosts via "%":
http://i.imgur.com/F92qeua.png
I get this mysql error:
http://i.imgur.com/OMAhtpg.png
You can also pass Socket parameter with this connection string.
or
you can try with the hostname instead of ipaddress.
if still youre issue is not resolved .Firewalls/iptables are enabled at server side so u need to stop it.

How to detect mysql server down status quickly

I have an application which connects a remote database server.
If mysql server stops for a reason and stars succesfully after that, my application cannot detect server status quickly. It takes nearly 20 seconds to reconnect to the database server. So my gui freezes. I do not want a gui freeze for 20 seconds
So far I tried
mysql_ping
mysql_real_connect
functions
MYSQL_OPT_RECONNECT
MYSQL_OPT_CONNECT_TIMEOUT
options
My enviroment is not multi-threaded. So
how to do a faster detection?
If you do networking synchronously, be prepared for freezes. For this very reason it makes sense to do data-manipulation in a separate thread.
You could try telnet to the mysql port (usually 3306). If you get a connection refused, mysql isn't listening.
Working.
root#XXXXXX:~# telnet localhost 3306
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
L
5.6.4-m7)#m#_8:W�hP5YBzaXs[MOmysql_native_password
Down.
root#XXXXXX:~# telnet localhost 3306
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
The refused message is almost instant.
As already discussed by others, i won't talk about using multiple threads or processes. Can you connect to your mysql server on tcp? That way in most scenario's you would receive a tcp fin immediately to indicate a closed connection, though at times this might not be the case even. But most robust applications do a proper close.
shell> mysql --protocol=TCP
MYSQL how to specify protocol
If server doesn't accept it, i believe it can be enabled from config settings.
However, this does not address scenarios such as server suddenly gets off the network, or you client's connection is down etc.

"Connection refused" error with CFFTP

I'm trying to setup a connection to FTP to transfer a file. Unfortunately, because of the environment the tools I have available to me are limited.
I'm receiving the following error:
An error occurred while establishing an FTP connection.
Error: Connection refused: connect.
Does this mean that I can reach the FTP server but the credentials are incorrect? Does it mean that I can't reach the server at all? Or is there no way to tell?
Update: I changed the IP address I was using to some other random number, so it's almost certainly because I can't connect. I wish there was a way to tell the difference between connectivity and authorization issues.
A "Connection Refused" error means that either the server you're trying to connect to isn't running an FTP server, or there's a firewall in your way that's preventing the connection.
An "User Authentication failed" error would usually occur if your credentials are bad.
FYI, for plain old FTP connections, the cfftp.errorCode may give you more information, once your are able to establish a connection. The errorCode will point to the response in the IETF FTP protocol standard , like "425", which would mean "Can't open data connection.".
Could be either one of those cases. Do you have a standalone FTP client to test with? Does it work from another machine?
hey check if your directory attribute is begining with a "/" character. this used to work through cf8 but stopped working for me in cf9 (specifically 9.0.1);
also try the following and see if this helps:
<cfftp connection="mycon" server="myserver.com" action="open" username = "anonymous" password = "anonymous" />
<cfdump var="#mycon#" label="">
<cfftp connection="mycon" action="getcurrentdir" result="result"/>
<cfdump var="#result#" label="">
you may find that its the listdir that is giving you the problem, not the connection.
You can check your ability to connect to the FTP server using Telnet at the command prompt(On windows, Go to Start > Run > type cmd).
telnet my-domain-name.com 21
you can try at non default port as you wish. That will let you know if your machine can reach the FTP server, and you can try logging on to check your credentials.
Here's a good post: Understanding FTP using raw FTP commands and telnet