Socket Error # 10093

Hi,

I am using Delphi 6 with Indy 10.5.

I have an application with a thread and a IdTCPClient component and 
sometime I receive then following error: Socket Error # 10093

Can anyone tell me what I have to care of to prevent this error to
occur?

Thank's
Al
0
Alain
6/4/2010 7:25:41 PM
embarcadero.delphi.winsock 1874 articles. 2 followers. Follow

5 Replies
3338 Views

Similar Articles

[PageSpeed] 28

"Alain Gosselin" <agosselin@gggolf.ca> wrote in message 
news:249051@forums.embarcadero.com...

> I have an application with a thread and a IdTCPClient
> component and sometime I receive then following error:
> Socket Error # 10093

10093 is WSANOTINITIALIZED ("Either the application has not called 
WSAStartup, or WSAStartup failed").

> Can anyone tell me what I have to care of to prevent this
> error to occur?

Without seeing your actual code, the only I can think of right now is you 
are misusing WinSock or Indy in your code.  Either you are calling 
WSACleanup or TIdStack::DecUsage() manually when you should not be.

-- 
Remy Lebeau (TeamB)
0
Remy
6/5/2010 12:10:15 AM
Le 2010-06-04 20:10, Remy Lebeau (TeamB) a écrit :
> "Alain Gosselin"<agosselin@gggolf.ca>  wrote in message
> news:249051@forums.embarcadero.com...
>
>> I have an application with a thread and a IdTCPClient
>> component and sometime I receive then following error:
>> Socket Error # 10093
>
> 10093 is WSANOTINITIALIZED ("Either the application has not called
> WSAStartup, or WSAStartup failed").
>
>> Can anyone tell me what I have to care of to prevent this
>> error to occur?
>
> Without seeing your actual code, the only I can think of right now is you
> are misusing WinSock or Indy in your code.  Either you are calling
> WSACleanup or TIdStack::DecUsage() manually when you should not be.
>

Remy,

when my application start, I start a thread which contain a 
TIdTCPClient. The thread look like this:

     while not Terminated do begin
        try
          if fTCPClient.IOHandler.InputBufferIsEmpty then
            fTCPClient.IOHandler.CheckForDataOnSource(500);

          if not fTCPClient.IOHandler.InputBufferIsEmpty then begin
            ReceivedText := fTCPClient.IOHandler.InputBufferAsString;

          ...

        except on E:Exception do
          begin

             ...

          end;
        end;

        Sleep(coSleep);
    end;

   fTCPClient.Disconnect;

When I close my application, in the FORMCLOSE, I termninate the thread 
and the error occur.

Honnestly, I don't know what you mean by WSACleanup or 
TIdStack::DecUsage(), is this within an Indy component ???

Thank's
Al
0
Alain
6/5/2010 2:09:40 AM
"Alain Gosselin" <heybigal@videotron.ca> wrote in message 
news:249173@forums.embarcadero.com...

> when my application start, I start a thread which contain a
> TIdTCPClient. The thread look like this:

Where is the TIdTCPClient created and destroyed?

> When I close my application, in the FORMCLOSE, I
> termninate the thread and the error occur.

Are you waiting for the thread to fully terminate before exiting the event 
handler?

-- 
Remy Lebeau (TeamB)
0
Remy
6/5/2010 5:34:04 AM
Le 2010-06-05 01:34, Remy Lebeau (TeamB) a écrit :
> "Alain Gosselin"<heybigal@videotron.ca>  wrote in message
> news:249173@forums.embarcadero.com...
>
>> when my application start, I start a thread which contain a
>> TIdTCPClient. The thread look like this:
>
> Where is the TIdTCPClient created and destroyed?
>
>> When I close my application, in the FORMCLOSE, I
>> termninate the thread and the error occur.
>
> Are you waiting for the thread to fully terminate before exiting the event
> handler?
>

APPLICATION
OnCreate
   mythread.create

FormClose
   mythread.Terminated
   Sleep(500)

THREAD
OnCreate
    IdTCPClient.create
    FreeOnTerminate = True

OnExecute
   IdTCPClient.Connect
   While not Terminated do begin
     ...
   end
   IdTCPClient.Disconnect

OnDestroy
   IdTCPClient.Free
0
Alain
6/5/2010 1:05:37 PM
"Alain Gosselin" <heybigal@videotron.ca> wrote in message 
news:249265@forums.embarcadero.com...

> FormClose
>   mythread.Terminated
>   Sleep(500)

You are accessing the thread's Terminanted property.  You need to call its 
Terminate() method instead.  You should also be using the thread's WaitFor() 
method instead of Sleep()'ing manually.

>    FreeOnTerminate = True

I strongly advise NOT using FreeOnTerminate=True in this situation, 
especially if you use WaitFor() (the two are NOT compatible with each 
other - WaitFor() will raise an exception).  You should only use 
FreeOnTerminate=True when you want to start a new thread and COMPLETELY 
ignore it.  If you make ANY references to the thread (even just to 
Terminate() it), then DO NOT use FreeOnTerminate=True at all.  Using 
FreeOnTerminate=True allows the thread object to destroy itself at any 
moment, which can happen before or even while you are accessing the thread.

Try this instead:

{code:delphi}
procedure TForm1.FormCreate(Sender: TObject);
begin
   mythread := TMyThread.Create;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  mythread.Terminate;
  mythread.WaitFor;
  mythread.Free;
end;

constructor TMyThread.Create;
begin
  inherited Create(False);
  { DO NOT set FreeOnTerminate = True!!!}
  IdTCPClient := TIdTCPClient.Create;
  ...
end;

destructor TMyThread.Destroy;
begin
  IdTCPClient.Free;
  inherited;
end;

procedure TMyThread.Execute;
begin
....
end;
{code}

-- 
Remy Lebeau (TeamB)
0
Remy
6/7/2010 6:35:05 PM
Reply:

Similar Artilces:

Delphi XE HTTP: error "Socket Error #10054 Connection reset by peer" [Edit]
Communication type is set to HTTP, LifeCycle is set to Invocation. Invocation represents a stateless connection, but when the network connection drops, the client throws the error "Socket Error #10054 Connection reset by peer". Are there any other properties to set up apart from LifeCycle? Hi Irina, > Communication type is set to HTTP, LifeCycle is set to Invocation. > > Invocation represents a stateless connection, but when the network connection drops, the client throws the error "Socket Error #10054 Connection reset by peer". Are there any other proper...

[PAClient Error] Error: E0009 Socket Error # 10054
I'm running Windows 7 using Fusion 5 on a Macbook Pro (OSX Maveric). I have recently been able to run and debug to my iPhone and to the iOS Simulator. When returning to my projects I'm no longer able to deploy my projects. (Only changes may be some updates to Windows 7). The Connection to the PAServer is successful and deploying a test project directly from XCode also works. The deployment stops at MyProject.dSYM. In fact Delphi deploys all files except MyProject.dSYM and MyProject if unchecked in the Deployment manager. What am I missing Br Petter It turned out tha...

winsock error 10038, not a valid socket
Trying to install an ipp printer using ie 5.5, sp1 get this error, afte clicking on "install" winsock error 10038, not a valid socket Did not find anything in KB. Joe, even if it does not exactly match your problem this seems to be a problem with httpstk. Does it load without any error ? Check this TID please for some troubleshooting steps http://support.novell.com/cgi-bin/search/searchtid.cgi?/10066950.htm -- Regards, Kai Reichert Novell Support Forums Sysop "Generosity. Be generous with your time, with your love, with your life. ... Be gene...

Error, Error and more errors
Okay, all I wanted to do was test this app out and it has been a nightmare. 1.) Didn't install the sql database. I had to manually install it. 2.) I get errors when trying to add a picture to an album. "Procedure or function ngUpdatePicture has too many arguments specified" Any ideas? I've gotten more errors than this, but there is no use in bitchin. Are you using the v1.6.1 installer? Also, did you select to install the SQL Server db and give it a valid admin login? What were some of the error messages? Did you have an existing DB from a previous install? ...

errors errors errors..
Name: harun Email: harunbjk1903hrnatgmaildotcom Product: Firefox Summary: errors errors errors.. Comments: first of all when i launch firefox (3) i cant enter websites via writing.. for example when I type "google" and then press ctrl and enter, it crashes.. and i take lots of error reports. firefox 2 was better.. see you again , harun Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.9) Gecko/2008052906 Firefox/3.0 From URL: http://hendrix.mozilla.org/ ...

error error error
These are the 2 new errors i am getting now:   1).  Server Error in '/' Application. Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.Source Error: Line 53: ...

Error reading from socket error
Hi there, We're using socket server 3-tier for many years. There are 4 application servers(win2000 server), for each up to 500 connections. While error reading from socket raised, we needed to restart socket server or even win2000 server. The socket server version is 5.1.0.0 with multi cpu bug fixed. Any ideas? Thank you ...

Delphi 2010 / IdHTTP problem: Socket Error # 0
Use D2010 Indy 10 gmail login with OAuth. When i send Post(https://accounts.google.com/o/oauth2/token,ABody,Response) In Indy on Line 2174 error "Socket Error # 0" case FHTTPProto.ProcessResponse(AIgnoreReplies) of In Delphi XE2 indy work withiut errors. <Roman Dukuy> wrote in message news:418271@forums.embarcadero.com... > Use D2010 Indy 10 > gmail login with OAuth. When i send > Post(https://accounts.google.com/o/oauth2/token,ABody,Response) > > In Indy on Line 2174 error "Socket Error # 0" > case FHTTPProto.ProcessResp...

Delphi 2010 / IdHTTP problem: Socket Error # 0 [Edit]
I have code that uses IdHTTP to do a HTTP Post to an HTTPS URL. I set my IdHTTP1.IOHandler to the object returned from TIdSSLIOHandlerSocketOpenSSL.Create(). After calling IdHTTP1.Post(posturl, slPostData), with slPostData being a TStringList.Create(); I get this exception: *Project OUTLOOK.EXE raised exception class EIdSocketError with message 'Socket Error # 0'.* I know for sure that the problem is not in my code, because I exported an earlier version of my source code that I know works for sure, compiled it with Delphi 2010, and I got the same problem. The same code works if ...

Delphi 5 Indy 10.0.52 connect error not socket
Please can someone explain what error is happening here or how to get an error code try SMTP.Connect; except on e:EidSocketError do begin {whole lots of error trapping here MessageDlg('Socket error on connection. Error code'+inttostr(LastSocketError), mtError, [mbOk], 0); end; on e:Exception do begin uLogFile.putLog('SendMail - Connect error not socket Error : '+e.message); ...

Delphi XE2, datasnap "Socket error 10061 connection refused"?
I cannot get it a datasnap application to work when a server app is installed on another Windows computer. It works fine on the when both client and server run on the same system. I have opened the port I am using in the Firewall on both computers. Any ideas? Thank you, Andre Hi Andrzej, > I cannot get it a datasnap application to work when > a server app is installed on another Windows computer. > It works fine on the when both client and server run on > the same system. I have opened the port I am using > in the Firewall on both computers. Which protocol a...

Winsock errors / 1322 errors- Solved
All, Had this issue with the winsock 10060 errors on OES Linux. Turns out the iprint doesn't like the http_proxy variable set on the iprint server (webserver). Solution is to either 1) unset http_proxy and restart apache (disable it system wide using Yast or edit /etc/sysconfig/proxy and disable there). 2) set no_proxy to include your internal DNS domain so that the proxy isn't used for these requests Turns out mod_ipp uses curl libraries and it respects the http_proxy stuff, but gives problems with the mod_ipp stuff for some reason. This also manifests itsel...

Delphi 2009
Hello, I am using Delphi 2009 with a recent Indy 10.5.5 development snapshot. In my code I am using a TIDHttp with TIDSSLIOHandlerSocketOpenSSL. The Open SLL .dlls I am using is from the the indy website and are openssl-0.9.8k-i386-win32. The issue is, randomly, I am getting a socket error # 0 error. I never got this error with Delphi 2007 and Indy 10.2.3. Any help would be GREATLY appreciated! Thank you. The code looks something like this: var sHttpResult, sVar, sParam: string; ssHttpResult : TStringStream; slPostData : TStringList; begin IdSSL.CheckForDi...

Error 890F socket read error on POA
We are experiencing this error on one of the 6.52 POA's. This is a MTP error though the Domain says that all connections are fine. We have noticed a much slower access to this PO as of late. The documentation says check communications between the MTA and POA but this all appears fine. Any thoughts as to what to do next? John Hendriks, > We are experiencing this error on one of the 6.52 POA's. This is a MTP > error though the Domain says that all connections are fine. We have > noticed a much slower access to this PO as of late. The documentation > says check c...

Web resources about - Socket Error # 10093 - embarcadero.delphi.winsock

AC power plugs and sockets - Wikipedia, the free encyclopedia
AC power plugs and sockets are devices that allow electrically operated equipment to be connected to the primary alternating current (AC) power ...

Ratcheting-Socket-Wrench-22156-480x360 - Flickr - Photo Sharing!
Free Photos – 3/8-Inch Ratcheting Socket Wrench / Chrome Socket Wrench /Repair and Fix Tool kits More photos and details about possible copyright ...

Mitch Robinson lied to Carlton about incident that left him with a broken eye socket
Mitch Robinson lied to Carlton officials when asked why he had suffered a broken eye socket during a scuffle in the early hours of Sunday morning. ...

Brisbane Broncos forward Alex Glenn facing six weeks on sideline with fractured eye socket
Wayne Bennett ranks Brisbane fullbacks as Justin Hodges injury leaves Broncos with fifth choice rookie

ConnectSense Smart Outlet lets Siri control two HomeKit Wi-Fi wall sockets, USB charge iPads
... of iPhone , iPad , and IPod Touch . What do you think? Discuss "ConnectSense Smart Outlet lets Siri control two HomeKit Wi-Fi wall sockets, ...

ASRock Rack Announces EP2C612D24 and 4L: Dual Socket Haswell-EP with 24 DDR4 Slots
... 16GB UDIMMs, this allows for a maximum of 384GB, although moving up to RDIMM, LRDIMMs or 64GB NVDIMMs pushes the max to 1.5TB in a dual socket ...

Windows Server 2016 moving to per core, not per socket, licensing
... until the second half of next year, is going to shake up the way Microsoft licenses its server operating system, moving away from per socket ...

Cool Chart of the Week: Solar Socket Parity In California, Australia, Germany, Italy, & Netherlands
I forget now how I ran across this chart, but it’s a nice one. It shows that residential solar PV power hit socket parity (aka grid parity) in ...

Dell Aims Four-Socket Server at Modern Database Hardware Needs
... out a greater percentage of the high-end server market, such as in-memory database hardware requirements, Dell today unveiled a four-socket ...

Video: Socket To Me! Nitwit At ‘Hand To God’ Tries To Charge Phone On Set
... on a performance of Hand To God at Broadway ’s Booth Theatre a few days ago, this patron leapt onstage and tried to plug his phone into a socket ...

Resources last updated: 1/20/2016 3:18:01 AM