G
Guest
I have a server (tcp/ip) that receives and sends back XML.
When I use the following code to send a login xml string my application
hangs. I think it is waiting for somekind of notification that the return xml
string has ended.
Dim LoginXml As XmlDocument = New XmlDocument
LoginXml.Load("Login.xml")
Dim newClient As TcpClient = New TcpClient
newClient.Connect(TextBox2.Text, TextBox3.Text)
Dim tcpStream As NetworkStream = newClient.GetStream
Dim xmlFile As String = LoginXml.OuterXml
Dim sendBytes() As Byte = Encoding.UTF8.GetBytes(xmlFile + "\r\n")
tcpStream.Write(sendBytes, 0, sendBytes.Length)
Dim strReader As streamreader = New
StreamReader(newClient.GetStream())
Dim returnData As String = strReader.ReadLine()
LoginXml.LoadXml(returnData)
Dim filename As String = "response.xml"
LoginXml.Save(filename)
Where am I going wrong?
When I use the following code to send a login xml string my application
hangs. I think it is waiting for somekind of notification that the return xml
string has ended.
Dim LoginXml As XmlDocument = New XmlDocument
LoginXml.Load("Login.xml")
Dim newClient As TcpClient = New TcpClient
newClient.Connect(TextBox2.Text, TextBox3.Text)
Dim tcpStream As NetworkStream = newClient.GetStream
Dim xmlFile As String = LoginXml.OuterXml
Dim sendBytes() As Byte = Encoding.UTF8.GetBytes(xmlFile + "\r\n")
tcpStream.Write(sendBytes, 0, sendBytes.Length)
Dim strReader As streamreader = New
StreamReader(newClient.GetStream())
Dim returnData As String = strReader.ReadLine()
LoginXml.LoadXml(returnData)
Dim filename As String = "response.xml"
LoginXml.Save(filename)
Where am I going wrong?