News  [SoftwareSite

Latest News
Older News
RSS Feed
 
Complete Projects
Useful Classes
Top Downloads
Message Board
AllAPI.net
 
Send Comments
Software License
Mentalis.org Buttons
Donate
 
Forums -> Security Library Forum
 
secure conn closed during receive  
by misha cai [misha_dpa at hotmail dot com]
posted on 2004/11/10

We got the following SocketException (for secure socket) during a socket receive operation.

A first chance exception of type 'System.Net.Sockets.SocketException' occurred in system.dll

Additional information: An established connection was aborted by the software in your host machine

=====

The server side is sending an xml stream of about 80k bytes and immediately closes the socket after the stream is sent. The client side receives the data ok until its last receive operation -- the socket is closed during the receive operation, thus the exception. If I put a delay (2 sec) on the server side before it closes the connection, then the client is ok.

Note that if I use normal network stream, then the exact same query works fine WITHOUT the delay.

QUESTION IS: how do we get the client to handle the close normally with the receive operation?

Is it possible for the client to know all data has been received and completes the read before process the close?

=======

STACK TRACE: (is for beta version but same problem with latest release):

====>

ssl.dll!Org.Mentalis.Network.VirtualSocket.Receive(byte[] buffer = {Length=65536}, int offset = 0, int size = 65536, System.Net.Sockets.SocketFlags socketFlags = None) Line 590 C#

ssl.dll!Org.Mentalis.Network.SecureSocket.ReceiveSecureBuffer(int maxSize = 4096, System.Net.Sockets.SocketFlags socketFlags = None) Line 621 + 0x1a bytes C#

ssl.dll!Org.Mentalis.Network.SecureSocket.Receive(byte[] buffer = {Length=4097}, int offset = 0, int size = 4096, System.Net.Sockets.SocketFlags socketFlags = None) Line 583 + 0xe bytes C#

ssl.dll!Org.Mentalis.Network.SecureNetworkStream.Read(byte[] buffer = {Length=4097}, int offset = 0, int size = 4096) Line 194 + 0x20 bytes C#

[<Non-user Code>]

dpcontrols.dll!com.dpapps.dpControls.dpRunQuery.FormatXml(System.Xml.XmlReader reader = {System.Xml.XmlTextReader}) Line 730 + 0xa bytes C#

dpcontrols.dll!com.dpapps.dpControls.dpRunQuery.runQuery(System.Xml.XmlNode queryNode = {System.Xml.XmlElement}, com.dpapps.dpIPC.dpIPCAddress adrCommunity = {com.dpapps.dpIPC.dpIPCAddress}, string dpUser = "100", System.Xml.XmlNode login = {System.Xml.XmlElement}, int chunkSize = 200) Line 401 + 0xc bytes C#

dpcontrols.dll!com.dpapps.dpControls.dpRunQueryAsync.ThreadProc() Line 117 + 0x42 bytes C#

by Pieter Philippaerts [Pieter at mentalis dot org]
posted on 2004/11/19

Are you also using the Security Library on the server side? If so, how do you close the connection? Do you simply call Close of do you call Shutdown first. If you do not call Shutdown first, the connection is abruptly terminated and this may result in the SocketException you're seeing on the client side.

 

Copyright © 2002-2007, The Mentalis.org Team. All rights reserved.
This site is located at http://www.mentalis.org/
Send comments to the webmaster.