API Support Forum
OEC API > API Support > Socket errors
Author Topic: Socket errors
(7 messages, Page 1 of 1)
Moderators: VPfau
WWatson2582
Posts: 38
Joined: May 03, 2018


Posted: Apr 26, 2021 @ 08:14 AM             Msg. 1 of 7
We have a client that reports having many socket error disconnections with GAIN COM API and did not have them with previous API. Is there a way we can diagnose this further or should he contact GAIN support directly for this?
CMicciche902
Posts: 318
Joined:


Posted: Apr 26, 2021 @ 11:44 AM             Msg. 2 of 7
We're not seeing socket issues with .NET clients. Make sure TCP ports 9210 and 9211 are open. Do you see any events in API logs?

Help Topics: https://gaincapital.zendesk.com/hc/en-us/articles/360019688498-Troubleshooting-your-internet-connection and https://gaincapital.zendesk.com/hc/en-us/articles/360014811237-What-ports-does-GAIN-Trader-use-I-m-seeing-a-message-unable-to-establish-connection-.

If you want to conference in the client, you can call our Support team https://gainfutures.com/contact/. We would perform ping and tracert tests. We don't know IRT well so we cannot assist with navigating around your front-end.
Chris M
WWatson2582
Posts: 38
Joined: May 03, 2018


Posted: Apr 29, 2021 @ 08:30 AM             Msg. 3 of 7
Good morning, Chris:

His ports 9210 and 9211 are working - this is not a case of unable to connect - it runs for a while and then randomly disconnects. GAIN's is the only server he is reporting having problems with, and he is our only client reporting this sort of problem. Here is his latest response to me:

--------------
I continue to have IRT problems disconnecting from Gain. It remains random, maybe 6-12x a day. Today not a single drop until 11:07 then about 6x in the afternoon.
1. Ports 9210 and 9211 are working. Attached is the netstat log file that shows IRT and Gain IP and Port addresses. Feel free to forward it to Gain. It shows Gain ("trader.exe") and Investor RT connected to Gain IP 66.76.151.30 through Port 9210 and 9211.
2. Per Gains instructions, I ran ping test on 173.219.221.161 and 64.74.108.94 without any issues. No drops and RT times around 30ms.
3. I ran tracert to prod.gainfutres.com and got 12 hops to suddenlink.net (per Gains instructions.) I did get a bunch of timeouts after reaching suddenlink,net but I don't think that matters.

---------------------
He forwarded to us a file containing netstat results that appears unremarkable.

Where is the "API Log" located? Is there one created internally by the COM API or is this something the COM API client (us) are supposed to be maintaining through (for example) API events like OnErrorOccurred?
WWatson2582
Posts: 38
Joined: May 03, 2018


Posted: Apr 29, 2021 @ 08:40 AM             Msg. 4 of 7
By the way, when he gets a socket error, the OnDisconnected event is called in our code with reason containing DisconnectionReason_SocketError and reason containing "Socket error" and that's all we apparently have to work with.

Is there any API settings we can twiddle that would make his connection more tolerant to momentary local disconnects or timeouts?
Edited by WWatson2582 on Apr 29, 2021 08:42 AM
JSmith5611
Posts: 128
Joined: Aug 11, 2015


Posted: May 03, 2021 @ 02:37 PM             Msg. 5 of 7
Is there any consistency of what the user is doing when the disconnect occurs? contract loads, bar loads, or anything else?
Jason Smith
JSmith5611
Posts: 128
Joined: Aug 11, 2015


Posted: May 03, 2021 @ 02:40 PM             Msg. 6 of 7
For logging, it can be enabled by doing:

GFAPI()>Logging>SetCategories(GF_Api_COM::LogCategory_All);

and addinf a handler for GFAPI()>Logging>OnNewMessageLogged.
Jason Smith
WWatson2582
Posts: 38
Joined: May 03, 2018


Posted: Jul 09, 2021 @ 08:36 AM             Msg. 7 of 7
I now have a second client reporting the same "socket errors" causing disconnection. Notably, once this error occurs, they are often unable to reconnect as the server sends a "user already connected" rejection message. I have both users contact GAIN account and contact details - please let me know how to forward them to you so you can follow up with them and hopefully get this solved.

I am not seeing any consistency in their actions causing the socket errors - they appear to happen randomly without any particular user action, without regard to data flow or market speed. They are both using the latest released COM API version (4.0.3.58). Typically all we see from the logging mechanism is something like this:

07/08/2021 11:33:13 - OnDisconnected(): Disconnected: reason [Socket error]