Click here to Skip to main content
15,505,126 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionMS Chart is adding extra X axis when doing multiple series. Pin
Member 1435926026-Nov-19 9:31
Member 1435926026-Nov-19 9:31 
QuestionHow to determine specific object from Msg.HWnd 'MESSAGE CLOSED' Pin
mo149225-Nov-19 3:32
mo149225-Nov-19 3:32 
AnswerRe: can not find the pin Pin
Richard MacCutchan17-Nov-19 22:17
mveRichard MacCutchan17-Nov-19 22:17 
Questiongroup by name for sum amount Pin
Member 1332257413-Nov-19 20:39
Member 1332257413-Nov-19 20:39 
AnswerRe: group by name for sum amount Pin
Dave Kreskowiak14-Nov-19 3:40
mveDave Kreskowiak14-Nov-19 3:40 
Questioncode project data base Pin
abuahmed20191-Nov-19 5:24
abuahmed20191-Nov-19 5:24 
AnswerRe: code project data base Pin
Dave Kreskowiak1-Nov-19 6:00
mveDave Kreskowiak1-Nov-19 6:00 
QuestionSystem.IO.IOException HResult=0x80131620 When using NetworkStream.Read function Pin
fd975029-Oct-19 23:48
professionalfd975029-Oct-19 23:48 
Hi,

Yesterday I ran into the exception mentioned in the title. In the mean time I have found a solution for it but I wonder why it happened, why the solution works and most importantly if someone else has run in to this sort of problem as well.

Below are some declarations and a few lines of code. The two lines of code are located in two separate functions: one to send an XML formatted message and one to receive the XML formatted response. The Write operation sends a 74 byte data block to the server. The Read operation receives a 105 byte data block sent back from the server to the client.

When I first tested the software I got the Exception mentioned in the title and it simply did not work. Using WireShark I could clearly see that both data blocks were sent back and forth as expected but on trying to read the supplied answer I always got the exception.

I finally managed to solve it by introducing a 20 millisecond delay before executing the Read operation whereas originally both operations executed very fast after each other, presumably well under a millisecond.

That makes me suspect that the problem is caused by calling the Read operation while the earlier Write operation is still ongoing in the background.

Both operations are asynchronous and I think it is quite possible that although the Write operation immediately returns there may very well be some ongoing background activity related to it so that when the Read operation is performed too fast it interferes and the Exception occurs.

Any thoughts, comments, remarks or bits of enlightenment would be very much appreciated.

Shared ClientSocket As System.Net.Sockets.TcpClient
Shared ClientStream As System.Net.Sockets.NetworkStream

ClientStream.Write(TxBuffer, 0, bytesToTx)
ClientStream.Read(RxBuffer, bytesRxed, RxBuffer.Length - bytesRxed)

AnswerRe: System.IO.IOException HResult=0x80131620 When using NetworkStream.Read function Pin
Richard MacCutchan30-Oct-19 0:09
mveRichard MacCutchan30-Oct-19 0:09 
GeneralRe: System.IO.IOException HResult=0x80131620 When using NetworkStream.Read function Pin
fd975030-Oct-19 0:23
professionalfd975030-Oct-19 0:23 
GeneralRe: System.IO.IOException HResult=0x80131620 When using NetworkStream.Read function Pin
fd975030-Oct-19 1:02
professionalfd975030-Oct-19 1:02 
QuestionHow to solve problem with datagrid and tabcontrol(vb.net) Pin
Member 1447080727-Oct-19 23:52
Member 1447080727-Oct-19 23:52 
AnswerRe: How to solve problem with datagrid and tabcontrol(vb.net) Pin
Richard MacCutchan28-Oct-19 0:14
mveRichard MacCutchan28-Oct-19 0:14 
GeneralRe: How to solve problem with datagrid and tabcontrol(vb.net) Pin
Member 1447080730-Oct-19 18:33
Member 1447080730-Oct-19 18:33 
GeneralRe: How to solve problem with datagrid and tabcontrol(vb.net) Pin
Richard MacCutchan30-Oct-19 23:58
mveRichard MacCutchan30-Oct-19 23:58 
QuestionVB Script stopped working on Windows 10 + Office 365 Pro Pin
Member 1463660627-Oct-19 22:29
Member 1463660627-Oct-19 22:29 
AnswerRe: VB Script stopped working on Windows 10 + Office 365 Pro Pin
OriginalGriff27-Oct-19 22:33
mveOriginalGriff27-Oct-19 22:33 
GeneralRe: VB Script stopped working on Windows 10 + Office 365 Pro Pin
Member 1463660627-Oct-19 22:36
Member 1463660627-Oct-19 22:36 
GeneralRe: VB Script stopped working on Windows 10 + Office 365 Pro Pin
OriginalGriff27-Oct-19 22:39
mveOriginalGriff27-Oct-19 22:39 
GeneralRe: VB Script stopped working on Windows 10 + Office 365 Pro Pin
Member 1463660627-Oct-19 23:28
Member 1463660627-Oct-19 23:28 
GeneralRe: VB Script stopped working on Windows 10 + Office 365 Pro Pin
OriginalGriff27-Oct-19 23:41
mveOriginalGriff27-Oct-19 23:41 
GeneralRe: VB Script stopped working on Windows 10 + Office 365 Pro Pin
Member 1463660627-Oct-19 23:53
Member 1463660627-Oct-19 23:53 
GeneralRe: VB Script stopped working on Windows 10 + Office 365 Pro Pin
OriginalGriff28-Oct-19 0:08
mveOriginalGriff28-Oct-19 0:08 
QuestionListbox event, ItemSelectionChanged, how to wait for last event, or cancel events Pin
jkirkerx24-Oct-19 8:36
professionaljkirkerx24-Oct-19 8:36 
AnswerRe: Listbox event, ItemSelectionChanged, how to wait for last event, or cancel events Pin
Dave Kreskowiak24-Oct-19 16:35
mveDave Kreskowiak24-Oct-19 16:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.