Re: [twsocket] TWSocket Digest, Vol 554, Issue 1

2014-01-28 Thread Noam weissman
gAuthStack->Count() > 0)
  {
AuthItem = (TAuthItem*)SendingAuthStack->Pop();

delete AuthItem;
AuthItem = NULL;
  }

  delete SendingAuthStack;
  SendingAuthStack = false;

  AuthSendSocket->Close();
  delete AuthSendSocket;
  AuthSendSocket = NULL;

  delete AuthCriticalSection;
  AuthCriticalSection = NULL;
}

//--
-

void __fastcall TAuthHandling::AuthSendSocketSessionConnected(TObject
*Sender, WORD ErrCode)
{
  TWSocket *Socket = (TWSocket*)Sender;

  if((AuthItem != NULL) && (AuthItem->L_ToIP == Socket->Addr))
  {
if(ErrCode == 0)
{
  // data is copied to the internal string. It should be ok up to
64K ?
  AuthSendSocket->SendStr(AuthItem->L_Data);

 DebugWinDlg->AddStringToMemoAndToFile("Sent this: " +
AuthItem->L_Data + ", To IP: " + AuthItem->L_ToIP);

  AuthSendSocket->ProcessMessages();
}
else
{
  // connection timed out
  if(ErrCode == 10060)
  {
DebugWinDlg->AddStringToMemoAndToFile("");
DebugWinDlg->AddStringToMemoAndToFile("** From
TAuthHandling::AuthSendSocketSessionConnected, Could not send Auth data
to device at IP: " + AuthItem->L_ToIP);
DebugWinDlg->AddStringToMemoAndToFile("");
  }
}


delete AuthItem;
AuthItem = NULL;

// close the socket in order to let other devices get their data.
AuthSendSocket->CloseDelayed(); //Close();
//AuthSendSocket->Close();
  }
}

//--
-

void __fastcall TAuthHandling::AuthSendSocketBgException(TObject
*Sender, Exception *E, bool &CanClose)
{
  TWSocket *Socket = (TWSocket*)Sender;

  if((AuthItem != NULL) && (AuthItem->L_ToIP == Socket->Addr))
  {
DebugWinDlg->AddStringToMemoAndToFile("");
DebugWinDlg->AddStringToMemoAndToFile("** From
TAuthHandling::AuthSendSocketBgException function, Exception: " +
E->Message);
DebugWinDlg->AddStringToMemoAndToFile("");
  }
}

//--
-

void __fastcall TAuthHandling::AddAuthFileToList(String ToIp, String
Data)
{
  TAuthItem *NewAuthItem = new TAuthItem(ToIp, Data);
//  TAuthItem *NewAuthItem = new TAuthItem("192.168.0.42", Data);

  AuthCriticalSection->Acquire();
  {
SendingAuthStack->Push(NewAuthItem);
  }
  AuthCriticalSection->Release();
}

//--------------------------
-

void __fastcall TAuthHandling::AuthSendSocketDataSent(TObject *Sender,
WORD ErrCode)
{
}

//--
-




-Original Message-
From: TWSocket [mailto:twsocket-boun...@lists.elists.org] On Behalf Of
Michael Gasser
Sent: Tuesday, January 28, 2014 4:25 PM
To: twsocket@lists.elists.org
Subject: Re: [twsocket] TWSocket Digest, Vol 554, Issue 1

Hi Noam

>>  you wrote: I have attached the code I am using.

Where is your code? I didn't receive any attachment.

Best regards
Michael



- Original Message - 
From: 
To: 
Sent: Tuesday, January 28, 2014 1:00 PM
Subject: TWSocket Digest, Vol 554, Issue 1


> Send TWSocket mailing list submissions to
> twsocket@lists.elists.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> or, via email, send a message with subject or body 'help' to
> twsocket-requ...@lists.elists.org
>
> You can reach the person managing the list at
> twsocket-ow...@lists.elists.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of TWSocket digest..."
>
>
> Today's Topics:
>
>   1. TWSocket strange problem (Noam weissman)
>
>
> --
>
> Message: 1
> Date: Tue, 28 Jan 2014 10:21:16 +0200
> From: "Noam weissman" 
> To: 
> Subject: [twsocket] TWSocket strange problem
> Message-ID:
> 
> Content-Type: text/plain; charset="us-ascii"
>
> Hi,
>
>
>
>
>
> First of all let me say a great thank you for a great TCP/IP
components
> set.
>
>
>
> I have a strange problem.
>
>
>
> I have a thread that has one TWSocket and a TStack.
>
> The socket is tcp and used as a client.
>
>
>
> I add messages to this Stack from another thread.
>
>
>
> In the thread that uses the TWSocket I read  one item at a time from
the
> stack.
>
>
>
> The item has a string and a destination IP.
>
>
>
> Every time I read one item from the stack I check that my socket is
> closed, connect to the IP in

Re: [twsocket] TWSocket Digest, Vol 554, Issue 1

2014-01-28 Thread Darin McGee
This list does not support attachments - embed code or provide address
for download.

-Original Message-
From: TWSocket [mailto:twsocket-boun...@lists.elists.org] On Behalf Of
Michael Gasser
Sent: Tuesday, January 28, 2014 9:25 AM
To: twsocket@lists.elists.org
Subject: Re: [twsocket] TWSocket Digest, Vol 554, Issue 1

Hi Noam

>>  you wrote: I have attached the code I am using.

Where is your code? I didn't receive any attachment.

Best regards
Michael



- Original Message - 
From: 
To: 
Sent: Tuesday, January 28, 2014 1:00 PM
Subject: TWSocket Digest, Vol 554, Issue 1


> Send TWSocket mailing list submissions to
> twsocket@lists.elists.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> or, via email, send a message with subject or body 'help' to
> twsocket-requ...@lists.elists.org
>
> You can reach the person managing the list at
> twsocket-ow...@lists.elists.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of TWSocket digest..."
>
>
> Today's Topics:
>
>   1. TWSocket strange problem (Noam weissman)
>
>
> --
>
> Message: 1
> Date: Tue, 28 Jan 2014 10:21:16 +0200
> From: "Noam weissman" 
> To: 
> Subject: [twsocket] TWSocket strange problem
> Message-ID:
> 
> Content-Type: text/plain; charset="us-ascii"
>
> Hi,
>
>
>
>
>
> First of all let me say a great thank you for a great TCP/IP
components
> set.
>
>
>
> I have a strange problem.
>
>
>
> I have a thread that has one TWSocket and a TStack.
>
> The socket is tcp and used as a client.
>
>
>
> I add messages to this Stack from another thread.
>
>
>
> In the thread that uses the TWSocket I read  one item at a time from
the
> stack.
>
>
>
> The item has a string and a destination IP.
>
>
>
> Every time I read one item from the stack I check that my socket is
> closed, connect to the IP in
>
> the message and wait for the SocketSessionConnected event.
>
>
>
> When the SocketSessionConnected is triggered I send the data and call
> CloseDelayed function
>
>
>
> Everything works just fine except that once in a few restarts to my
> application I get an exception
>
> that IP address is not defined. My IP is defined and has no problems
> that I can see ?
>
>
>
> What am I doing wrong or is there a bug in TWSocket ?
>
>
>
> I have attached the code I am using.
>
>
>
> Any assistance will be appreciated.
>
>
>
> BR,
>
> Noam.
>
>
>
>
>


> This footnote confirms that this email message has been scanned by
> PineApp Mail-SeCure for the presence of malicious code, vandals &
computer 
> viruses.
>


>
>
>
>
>
> --
>
> Subject: Digest Footer
>
> ___
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>
> --
>
> End of TWSocket Digest, Vol 554, Issue 1
>  

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TWSocket Digest, Vol 554, Issue 1

2014-01-28 Thread Michael Gasser

Hi Noam


 you wrote: I have attached the code I am using.


Where is your code? I didn't receive any attachment.

Best regards
Michael



- Original Message - 
From: 

To: 
Sent: Tuesday, January 28, 2014 1:00 PM
Subject: TWSocket Digest, Vol 554, Issue 1



Send TWSocket mailing list submissions to
twsocket@lists.elists.org

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
or, via email, send a message with subject or body 'help' to
twsocket-requ...@lists.elists.org

You can reach the person managing the list at
twsocket-ow...@lists.elists.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of TWSocket digest..."


Today's Topics:

  1. TWSocket strange problem (Noam weissman)


--

Message: 1
Date: Tue, 28 Jan 2014 10:21:16 +0200
From: "Noam weissman" 
To: 
Subject: [twsocket] TWSocket strange problem
Message-ID:

Content-Type: text/plain; charset="us-ascii"

Hi,





First of all let me say a great thank you for a great TCP/IP components
set.



I have a strange problem.



I have a thread that has one TWSocket and a TStack.

The socket is tcp and used as a client.



I add messages to this Stack from another thread.



In the thread that uses the TWSocket I read  one item at a time from the
stack.



The item has a string and a destination IP.



Every time I read one item from the stack I check that my socket is
closed, connect to the IP in

the message and wait for the SocketSessionConnected event.



When the SocketSessionConnected is triggered I send the data and call
CloseDelayed function



Everything works just fine except that once in a few restarts to my
application I get an exception

that IP address is not defined. My IP is defined and has no problems
that I can see ?



What am I doing wrong or is there a bug in TWSocket ?



I have attached the code I am using.



Any assistance will be appreciated.



BR,

Noam.





This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer 
viruses.







--

Subject: Digest Footer

___
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

--

End of TWSocket Digest, Vol 554, Issue 1
 


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be