View Single Post
  #3 (permalink)  
Old 12-29-2005, 01:26 PM
fxtrader625 fxtrader625 is offline
Freshman
 
Join Date: Dec 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
fxtrader625 is on a distinguished road
Default

Quote:
Originally Posted by scorpion
It is most likely problem inside mtapi.dll provided by MetaQuotes. My code (MT3APIDotNet.DLL) only take error code from mtapi.dll and raise managed exception.

Probably this is caused by the disconnection from mt server, or problably you miss a few calls to Disconnect() or Dispose() in api objects. You can simply reconnect back by first catch the exception, call disconnect() and then connect(). Everything would be just fine.
Well, thanks for your reply, but in a meanwhile, I have just resolved the socket problem. It happens that when I have left already all 10 sockets connected, I got an exception "Cannot create a new socket". From this point, you cannot create a new socket anymore, since all sockets were busy. So, I have added a static function to MT3APIWrapped module, to force socket deletion:

Code:
Public Shared Sub Dispose(ByVal Socket As Integer) MtDelete(Socket) End Sub
After recompiling MT3APIWrapped module, I called this function 10 times, from socket = 1 to 10, then everything works fine.

Jeff
Reply With Quote

Registered members have access to special online forex currency trading tools, software, mt4 expert advisors and indicators. Register now

Main Menu

Economic Forecast