'System.Net.Sockets.SocketException' in ImapX.dll

Topics: Help requests
Aug 17, 2016 at 3:31 PM
Hey ! Sorry, I d'ont speak english very well but I will do my best to explain the problem.

I download all messages from a folder (inbox in this case) which have 1004 messages. and I have couple folders which exceeds 100 messages.

like the image below :

But during the download the system throw an exception : 'System.Net.Socket.SocketException'
The program transfer all messages from GMAIL or anything else to an Exchange mailbox.
so when the program download messages it save them in Process Memory.
And after it have downloading all message from the curent folder (here inbox) it upload them to exchange mailbox but it crash before the upload because process memory get out of bound.
So I have no idea to resolve this...

Than's Clem from AIS french company
Aug 24, 2016 at 2:07 PM

I up this.

Cause I solve the problem of process memory but 'System.Net.Socket.SocketException' is not an exception about process memory.
it's IMAP connection error...
error code is : 10057 and it's refer to :
Socket is not connected
Description: A request to send or receive data is not permitted because the socket is not connected and (when sending on a datagram socket using sendto [Wsapiref_4sqa.asp], no address was supplied). Any other type of operation may also return this error, for example, setsockopt (Wsapiref_94aa.asp) setting SO_KEEPALIVE if the connection has been reset.
The error seems happen during this --> ExchObject.UploadMail(currentFolderId, mail, mailUid);

When use personal log system with console.wrtiteline(IMAPObject.IMAPService.IsConnected), it write false just after UploadMail ...
So the IMAP connection is shutdown by something...
à ImapX.ImapBase.SendAndReceive(String command, IList`1& data, CommandProcessor processor, Encoding encoding, Boolean pushResultToDatadespiteProcessor) dans C:\Users\pavel\Downloads\imapx-43207\ImapX\ImapBase.cs:ligne 344
à ImapX.Folder.Select() dans C:\Users\pavel\Downloads\imapx-43207\ImapX\Folder.cs:ligne 439
à ImapX.Message.CopyTo(Folder folder, Boolean downloadCopy) dans C:\Users\pavel\Downloads\imapx-43207\ImapX\Message.cs:ligne 623
à ImapX.Message.MoveTo(Folder folder, Boolean downloadCopy) dans C:\Users\pavel\Downloads\imapx-43207\ImapX\Message.cs:ligne 608
à AISMailboxMigrator.MigrationMails.ImportFolder(Folder imapFolder, FolderId exchFolder) dans C:\TFS_CPL\AIS\SAO006-AisMailboxMigrator\AIS Mailbox Migrator\AIMM\AMM\AMM\MigrationMails.cs:ligne 294
IDE's console :
'System.Net.Sockets.SocketException' dans ImapX.dll
I've changed the code, see the pic below :