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