RE: Send and receive XML using tcpclient

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Anyone?

"Philip Wagenaar" wrote:

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



Relevant Pages

  • Re: Editting an XML file
    ... I have an overriden XmlDocument. ... A whole segment of my XML is disappearing during my save. ... Here is an example how you could build your own method to find child ...
    (microsoft.public.dotnet.xml)
  • Re: Convert String data from Web Service to XML
    ... Are you using Xlang or external .net assembly to load xml? ... XmlDocument temp2 = ... why not use temp instead of temp2, ... I am trying to Convert String data from Web Service to XML ...
    (microsoft.public.biztalk.general)
  • Re: XPathNavigator.SelectSingleNode(xpath) on space returns 0 leng
    ... But I can use the Stream to create an XmlDocument, ... why does XPathDocument eat all of the whitespace? ... Because xml schemes like Excel's SpreadsheetML need it. ... XmlDocument without preserveWhitespace, ...
    (microsoft.public.dotnet.xml)
  • Re: Using XPath Against A Node
    ... made to the XML DOM passed into the DoSomeXmlProcessing, ... Dim WholeXmlDocument As New XmlDocument ... If Not VehicleNode Is Nothing Then ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Inserting Nodes at specific location in XML
    ... XmlTextReader xmlReader = new XmlTextReader; ... XmlNode nextResults = xmlDocument.ReadNode; ... If there are any further results then the XML ... If you use the DOM and you have an XmlDocument instance then you can use ...
    (microsoft.public.dotnet.xml)