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
 
Connection Hangs after transfer twice?  
by B Williams [brennonwilliams at yahoo dot co dot uk]
posted on 2004/11/05

Hello,
After spending the better part of a few days trying to get my connections working I finally reached a point that the connection stayed open, allowed me to send to the server and then allowed me to get some more data back. Great!

Just when I thought it was all going so well, when I try to then either send more data or get any new data sent from the server, my connection hangs???

The process of communication for this particular server is:

Client connect
Client Send Version Tag
Server Send Version Tag
Client Get Version Tag

**** This all works fine ***
Then
Server Send "User : "
Client Get data from stream..

This is the point that it fails... I can never get the "User : " tag sent from the server ??? It just hangs, no timeouts no nothing, even the connection is still open.

Here is what I am using to read/write to the stream

'************ WRITE SUB

Private Sub cmd_Send_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_Send.Click

Try

'Get a client stream for reading and writing.
MyMasterWriter.WriteLine(txt_sendtext.Text)
MyMasterWriter.Flush()

AddStat("Send Complete")

Catch ex As Exception
MsgBox("Error Sending Data. " & ex.Message)
End Try
End Sub

'************ READ SUB

Private Sub cmd_read_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_read.Click

Try
Dim responseData As String
'Read the data from the stream
If MyMasterReader.Peek > 0 Then
responseData = MyMasterReader.ReadLine
End If
'Print the string in the box
txt_recbox.Text = txt_recbox.Text & responseData & vbCrLf

'Show a read symbol
txt_recbox.Text = txt_recbox.Text & "------" & vbCrLf

Catch ex As Exception
MsgBox("Error Receiving Data. " & ex.Message)
End Try
End Sub



I am using what is said to be the current version....

PLEASE HELP.... hair going gray....

by B Williams
posted on 2004/11/05

Fixed.. well not really... sort of...

It would appear that if I dont try to read any data from the stream after I have sent the Version Tag, but just go ahead and send the next piece of data the server is wanting and then read from the stream that it all works...

This is a fix but it still must be seen as a bug that the connection hangs if the stream is read before 2 seperate packets are sent.

Just thought that it might be handy if someone else is getting the same problem...

 

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