Hi,

Well the problem was found and it was a misunderstanding on my behalf.

My sending function is a bit complicated. It involves reading from file
and updating the display.
The OnDataSent event was calling my function. The problem was that the
event was triggered faster
then expected. As a result my function was called recursively. 

I found the clue in one of older posts and also a this old but good help
gave more insight: 
  http://www.mestdagh.biz/ics/help

I changed my code and instead of calling the sending function directly
from the OnDataSent I am posting 
a message inside the OnDataSent event to the window. 

Just to be on the safe side I have also added a CriticalSection in my
sending function. This way even if 
the OnDataSent is triggered before I finish handling everything, it is
stalled.

Now the send process is completely synchronized without the need of
adding delays etc...


Thanks,
Noam.


-----Original Message-----
From: TWSocket [mailto:twsocket-boun...@lists.elists.org] On Behalf Of
Noam weissman
Sent: Monday, February 17, 2014 12:14 AM
To: twsocket@lists.elists.org
Subject: [twsocket] TWSocket problem

Hi,
 

I am working on a control application that uses a few ICS components.
One of this application options is firmware update to embedded device
over TCP.

I have created a form that has one TWSocket, a few timers, progress bar
etc... In general the user chooses a file to download to the device and
clicks a button to start the process.
This form is created dynamically, it creates the socket and all. The
application can open as many forms as the user needs. Every form has its
own state machine and its own buffer , socket etc...

The update worked fine for a single device and even for 2-3 concurrent
updates.  For some reason when I triad running more then 4 forms,
sometimes the application crashed completely, sometimes one of the forms
stopped the file transfer and timed out.

After making a few changes I am now stacked with a Stack Overflow
exception and no matter what I do I cannot run even one form.

The stack overflow is inside the TWSocket. I am sending a 4K bye buffer
and then in the DataSent event I send another one and another one...

Actually the stack overflow happened when I triad to send smaller
buffers (1K) now even after returning to the previous code with 4K
buffer I still get the stack overflow.

I am using XE4 with C++

Any ideas or suggestions would 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.
************************************************************************
************



--
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

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




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



-- 
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

Reply via email to