Reusing a pop3socket

Hi all
I am using a pop3securesocket just to check the messages via retrieve lines.
When I am finished using it or I click in a button to stop the check, I disconnect the socket and the event gets fired
Next I close the socket (closing the socket or not leads to same result.
The problem arises when I try to reuse the socket
It connects via the relative event and I get from the server a wrong command error, like it wasn’t disconnected earlier.
Any help would be greatly appreciated.
Antonio

It’s likely that the internal state of the socket isn’t getting reset. You should file a bug report and we’ll look at it.

In the mean time, you could just re-initialize the socket from scratch.

Maybe it is the same problem I encountered years ago (I think 2012). Unfortunately I cannot find the relevant post on this forum.
And I did not file a bug report because the problem could not be reproduced consistently.
Anyway, from that time my workaround has been to put the socket in its own window (let’s call it pop3Win), then: from the main window, call pop3Win when accessing the first account; close it when the socket job is done; reopen pop3Win from the main window to access the second account, and so on and so forth.

In the error event of the pop3socket in pop3Win:
if ErrorCode = 22 then
//MsgBox “err 22”
Return
end if

Thanks for the replies
Only way I found to solve the problem was to call disconnect and purge from inside the control. calling it from outside yielded the errors in the previous post.

Thanks for your support

after almost 2 year the bug it’s still there and what’s worse my workaround doesn’t work anymore.
I guess if problem won’t be resolved very soon I’ll have to rewrite my app almost from scratch.

[quote=378220:@antonio cocco]after almost 2 year the bug it’s still there and what’s worse my workaround doesn’t work anymore.
I guess if problem won’t be resolved very soon I’ll have to rewrite my app almost from scratch.[/quote]
Did you file a bug report in Feedback like I suggested?

Unfortunately I didn’t

First - I have never used a pop3socket, so I might be off on the wrong track.

This might apply:
http://www.serverframework.com/asynchronousevents/2011/01/time-wait-and-its-design-implications-for-protocols-and-scalable-servers.html

In my experience - never re-use an outbound socket. Just create a new one.

[quote=302208:@Greg O’Lone]It’s likely that the internal state of the socket isn’t getting reset. You should file a bug report and we’ll look at it.

In the mean time, you could just re-initialize the socket from scratch.[/quote]

How could I reinitialise the socket?

Bug its still there obviously

Thank you

Antonio

[quote=395271:@antonio cocco]How could I reinitialise the socket?

Bug its still there obviously

Thank you

Antonio[/quote]
Reinitialize by creating a new instance. Each time you need to use it,

Dim s as new pop3securesocket

Thanks for your reply Greg, but this way I’ll lose all the code I initially wrote
I worked around it subclassing the control and adding handlers for the events needed.
But it was quite a long job
Thanks

Unfortunately it’s the only way to know that the socket is in a clean state when you want to use it again.