Hello,I'm trying to write a program that tests a LAN and I can't continue the test because Windows system messages always appear.I tried setting SetErrorMode (SEM_NOGPFAULTERRORBOX); but it does not work.

please note: the address 0.0.0.0 even if it is not valid, I set it on purpose to run the test and continue in case of error.

mark_c wrote:I'm trying to write a program that tests a LAN and I can't continue the test because Windows system messages always appear.I tried setting SetErrorMode (SEM_NOGPFAULTERRORBOX); but it does not work.

Of course not, because there is no system dialog being displayed in this situation, just a VCL dialog for a thrown exception. SetErrorMode() has no effect on that.

Change ESocketError to Exception in your catch block.

If you are still seeing the dialog, the only remaining way that can happen is if you are running your code inside the debugger, which of course will always display a thrown exception (even if it is caught later) unless you tell it not to.

this event was already set but did not want to work. I deleted and rewrote it and now it works, as if it were invisible to the compiler before the deletion.

More likely, it simply wasn't assigned to the TClientSocket::OnError event, like you thought it was.

mark_c wrote:how to synchronize connection, download and disconnection?If I run this program, the second connection does not wait for the entire download of the first to be terminated but to interrupt it.

That is because TClientSocket runs in non-blocking mode by default, so you need to change it to blocking mode. And also because you are not actually implementing the HTTP protocol, otherwise you would know exactly when the 1st download is complete before then invoking the second download.

But really, why are you handling this manually at all, instead of using a pre-existing HTTP component/library instead? HTTP is not trivial to implement from scratch. There are many HTTP implementations available for C++Builder. Indy (which comes pre-installed) has a TIdHTTP client component. Other popular libraries like ICS and Synapse have their own HTTP clients, too. Or, just use Microsoft's own WinInet or WinHTTP APIs that are built into Windows itself.

lbrown7278 wrote:This is the same problem that I have also faced while setting the Epson printer with the Windows 7 system, and it was showing epson error code 0xf4 while I connect the printer on my system. Can anyone solve the error?

That has nothing to do with this discussion, or even with sockets in general. That is a printer error, not a socket error.