问题
I was trying out bloomberg c++ api example. Got the error below:
ritesh@Ritesh:~/Desktop/blpapi_cpp_3.7.5.1/Linux$ ./RequestServiceExample_64
RequestServiceExample
Connecting to port 8194 on localhost
Server is starting------
20JUL2014_09:18:35.921 7794:139791222232832 ERROR blpapi_platformtransporttcp.cpp:671 blpapi.session.transporttcp.{1}.<localhost:8194> Connection failed
20JUL2014_09:18:35.921 7794:139791222232832 WARN blpapi_platformcontroller.cpp:371 blpapi.session.platformcontroller.{1} Platform: 0 failed 1 consecutive connect attempts, stopped trying to reconnect.
Server received an event
20JUL2014_09:18:35.922 7794:139791222241088 ERROR blpapi_providersessionimpl.cpp:640 blpapi.providersession.{1} Failed to start provider session: rc=9
Failed to start server session.
Client is starting------
SessionStartupFailure = {
reason = {
source = "Session"
category = "IO_ERROR"
errorCode = 9
description = "Connection failed"
}
}
20JUL2014_09:18:35.922 7794:139791141598976 ERROR blpapi_platformtransporttcp.cpp:671 blpapi.session.transporttcp.{2}.<localhost:8194> Connection failed
20JUL2014_09:18:35.922 7794:139791141598976 WARN blpapi_platformcontroller.cpp:371 blpapi.session.platformcontroller.{2} Platform: 0 failed 1 consecutive connect attempts, stopped trying to reconnect.
Failed to start client session.
Client received an event
Press ENTER to quit
SessionStartupFailure = {
reason = {
source = "Session"
category = "IO_ERROR"
errorCode = 9
description = "Connection failed"
}
}
ritesh@Ritesh:~/Desktop/blpapi_cpp_3.7.5.1/Linux$
Does anyone has idea about the api? What is the connection that it is trying to connect to? Do I need any additional server listening on the port 8194?
回答1:
In order to use the Bloomberg API SDKs, you need a Bloomberg data feed, which is delivered as part of a Bloomberg subscription product. The API SDK connects to the data feed endpoint using a TCP connection on port 8194 (as you can see), and the example programs assume there is an endpoint on 'localhost' (as there is on any machine with an operating Bloomberg Professional terminal).
You are running this on a Linux machine, and unless you've installed a data feed appliance package on that machine, you don't have an API endpoint on 'localhost'. If you have an API endpoint in your network, you'll need to specify the proper command line arguments to the example program to tell it the IP address (and port number, if non-default) of your API endpoint.
(Also, note that the specific example program you are trying to run is a 'publisher', and requires a Platform API endpoint for connection, it will not work with any other type of API endpoint)
回答2:
Your log file indicates error 9, which seems to suggest an address is already in use. Run the netstat
command to see if another program is already using the port you've bound to localhost
来源:https://stackoverflow.com/questions/24846495/bloomberg-api-connection-issue-localhost8194-connection-failed