Socket error 10061

Hi!

I cant seem to get the API to work. I have enabled the service and also made a firewall rule for port 8291.
The Mikrotik API Studio reports the following error when I am trying to connect: “tr_mkrouter.open opening router socket error = 10061”.
I have opened ports on my end in the same fashion we’ve opened for Winbox (which works just fine btw).

Out Mikrotik is placed on a different LAN but it shouldn’t cause any issues I hope.

I would love to paste in some /ip server export and stuff, but frankly, the terminal Window (in Winbox) is not responding at all at the moment, so no luck there.

Also: when I am trying to connect through the API I can see that the firewall rule is getting a couple of packages.

Thanks in advance.
firewall rule.jpg
dead terminal.jpg

You need to whitelist “Mikrotik API Studio” at the Windows Firewall and/or at whatever firewall software you’re using. More precisely, you need to allow it to make outgoing connections.

Opening the port 8728 on Windows doesn’t cut it (in fact, it’s not needed at all… remove that rule).

Yeah, thats what i have done. I have allowed outgoing Connections for that port in our Corporate firewall.

Outgoing connections from or to that port?

You’d need outgoing connections to that port.

Is there any chance you could temporarily turn off this firewall and then try? You know, to ensure it’s its fault, and not something else (e.g. the router’s fault).

There is no error with the firewall on our part. I get the exact same error message when trying to connect while being on our BYOD-net, which is not limited by a firewall. (Winbox still works just fine though)
And I can still see the bytes and packets counter increase on the firewall, so the Mikrotik is in fact recieving some kind of traffic on the correct port.

OK. In that case, it could be a user permission or IP limitation.

First, in “/ip service”, make sure there’s nothing in the “address” column.

Also, in “/user”, make sure the “address” column is either empty or at least features the IP you’re connecting from. Last, but not least, check what group the user is in, and make sure that group has “api” priviliges.

The problem is fixed, it was as easy as rebooting the mikrotik (which isn’t easy in a live environment hence why this wasn’t tried before asking for help and in my mind mikrotik’s where more stable than that. :O).
The terminal window is also responding correctly now.

Thanks for your help though! :slight_smile: