Board index » delphi » TWSocket problem -- 10038 - WSAENOTSOCK

TWSocket problem -- 10038 - WSAENOTSOCK

Hi Everyone,

I have the following code (I removed all the lines that are not important
for the issue):

//*********************************************************************//
library CREDT_NOF;
uses
  WSocket in '..\WSocket.pas';
type
  TGatewayWait = Class
  Public
    WHubClient: TWSocket;
  End;
Procedure SEND_CREDT_NOF (glbParam: LPSTR; size: Short); StdCall; export;
Var
      GatewayWait : TGatewayWait;
Begin
  Try
    GatewayWait.WHubClient := TWSocket.Create(Nil);
  Except
    On E: Exception do Pr_Log('***** Error creating TWSocket [' + E.Message
+ '] *****'); // <== Just to log the error in a text file
  End;
End;
Exports SEND_CREDT_NOF;
Begin
end.
//**********************************************************************//

and some times I'm getting the exception in the sentence that is inside the
'try', the exception that I'm getting is 10038 - WSAENOTSOCK but it is not
happening all the time, however I'm not an expert delphi programer and I
don't konw why is this exception ocurring and how I can workaround that. The
average is 40% of the times that the dll is running I'm getting the
exception.

Thanks a lot for your help in advance.

Carlos.

 

Re:TWSocket problem -- 10038 - WSAENOTSOCK


Sorry, by mistake I removed an important line when I was trying to clean the
code here to have just the code related to the issue.  I was missing the
creation for the main object, so the real code looks like that:

//*********************************************************************//
library CREDT_NOF;
uses
  WSocket in '..\WSocket.pas';
type
  TGatewayWait = Class
  Public
    WHubClient: TWSocket;
  End;
Procedure SEND_CREDT_NOF (glbParam: LPSTR; size: Short); StdCall; export;
Var
      GatewayWait : TGatewayWait;
Begin
  GatewayWait := TGatewayWait.Create;
  Try
    GatewayWait.WHubClient := TWSocket.Create(Nil);
  Except
    On E: Exception do Pr_Log('***** Error creating TWSocket [' + E.Message+
'] *****'); // <== Just to log the error in a text file
  End;
End;
Exports SEND_CREDT_NOF;
Begin
end.
//**********************************************************************//

Quote
"Carlos Suarez" <suar...@optonline.net> wrote in message

news:3d0a54f4$1_2@dnews...
Quote
> Hi Everyone,

> I have the following code (I removed all the lines that are not important
> for the issue):

> //*********************************************************************//
> library CREDT_NOF;
> uses
>   WSocket in '..\WSocket.pas';
> type
>   TGatewayWait = Class
>   Public
>     WHubClient: TWSocket;
>   End;
> Procedure SEND_CREDT_NOF (glbParam: LPSTR; size: Short); StdCall; export;
> Var
>       GatewayWait : TGatewayWait;
> Begin
>   Try
>     GatewayWait.WHubClient := TWSocket.Create(Nil);
>   Except
>     On E: Exception do Pr_Log('***** Error creating TWSocket [' +
E.Message
> + '] *****'); // <== Just to log the error in a text file
>   End;
> End;
> Exports SEND_CREDT_NOF;
> Begin
> end.
> //**********************************************************************//

> and some times I'm getting the exception in the sentence that is inside
the
> 'try', the exception that I'm getting is 10038 - WSAENOTSOCK but it is not
> happening all the time, however I'm not an expert delphi programer and I
> don't konw why is this exception ocurring and how I can workaround that.
The
> average is 40% of the times that the dll is running I'm getting the
> exception.

> Thanks a lot for your help in advance.

> Carlos.

Other Threads