Hey Guys,
I am trying to convert some C# code that processes real-time data streaming of financial data.
My application uses the TCP socket-based client from https://www.IQFeed.net to receive the data during market hours. My Julia version works fine when the IQFeed client is running on my Windows 11 machine.
My source code for the Julia version is at GitHub - CBrauer/IQFeed-julia: Process real-time streaming data from the major stock exchanges..
The Julia code to connect to the IQFeed client is:
function socket_init()
Display("At socket_init.")
try
# Connect to the server and display socket and peer details
inet_addr = Sockets.InetAddr(IPv4("127.0.0.1"), 5009)
global socket = Sockets.connect(inet_addr)
sockname = getsockname(socket)
peername = getpeername(socket)
Display("ip $(sockname[1]), port $(sockname[2])")
Display("ip $(peername[1]), port $(peername[2])")
Display("socket has been initialized.")
catch err
if err.code == Base.UV_ECONNREFUSED
Display("Error in initializing the socket: $err")
end
end
end
Here is my problem. If IQFeed.exe is not running, I do not get a connection refused error in my try/catch block. Why not?
How can I catch the TCP socket connect problem gracefully.?
Any suggestions will be greatly appreciated.
Charles