通过套接字发送XML数据 [英] Sending XML data via socket

查看:67
本文介绍了通过套接字发送XML数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将非dontnet进程的XML数据发送到.Net通过套接字

监听器。

这是一个数据样本:

< VFPData>

< serverdata>

< coderun> updateFloor< / coderun>

< area> MD2< / area> ;

< zone> BOXING< / zone>

< status>正在运行< / status>

< job> 1000139233< /工作>

< sku> 02219< / sku>

< finished> 88< / finished>

< / serverdata>

< / VFPData>

我的问题是,有时它会出现像这样的列表:

< VFPData>

< serverdata>

< coderun> updateFloor< / coderun>

< area> MD2< / area>

< zone> BOXING< / zone>

< status>正在运行< / status>

< job> 1000139233< / job>

< sku> 02219< / sku>

< finished> 88< / f inished>

< / serverda

ta>

< / VFPData>

或类似:< br $>
< VFPData>

< serverdata>

< coderun> updateFloor< / coderun>

<区域> MD2< / area>

< zone> BOXING< / zone>

< status>正在运行< / status>

< ;工作> 1000139233< / job>

< sku> 02219< / sku>

< fini

shed> 92< / finished> ;

< / serverdata>

< / VFPData>

我确信发送过程以适当的格式发送所有数据

时间。

我需要做些什么来保持XML的良好形成?


谢谢

解决方案

Markgoldin,


代表什么换行符?是否存在以某种方式注入流中的实际换行符

,或者它是否表示您从服务器读取的内容中的

中断?


您从流中调用的代码是什么?你是否需要检查返回值才能看到你请求读取的所有字节实际上都被读取了,或者你只是假设这些字节是

是否被完全读取?

-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" Markgoldin" < ma ************* @ yahoo.comWrote in message

news:u4 ************** @ TK2MSFTNGP04。 phx.gbl ...


>我通过socket
监听器将非dontnet进程的XML数据发送到.Net。

这是一个数据样本:

< VFPData>

< serverdata>

< coderun> updateFloor< / coderun> ;

< area> MD2< / area>

< zone> BOXING< / zone>

< status>正在运行< /状态>

< job> 1000139233< / job>

< sku> 02219< / sku>

< finished> 88< / finished>

< / serverdata>

< / VFPData>

我的问题是,有时它会出现像这样的列表器:

< VFPData>

< serverdata>

< co derun> updateFloor< / coderun>

< area> MD2< / area>

< zone> BOXING< / zone>

< ;状态>正在运行< / status>

< job> 1000139233< / job>

< sku> 02219< / sku>

< finished> 88< / finished>

< / serverda

ta>

< / VFPData>

或类似:

< VFPData>

< serverdata>

< coderun> updateFloor< / coderun>

< area> MD2< / area>

< zone> BOXING< / zone>

< status>正在运行< / status>

< job> 1000139233< / job>

< sku> 02219< / sku>

< fini

棚> 92< / finished>

< / serverdata>

< / VFPData>

我确信发送过程以适当的格式发送数据所有

时间。

我需要做些什么来保持XML的良好形成?


谢谢



<是否有实际的换行符


以某种方式注入流中



是的,我认为就是这样。我不是在这些

的位置发送换行符。


<你用来从流中调用的代码是什么?

我的代码发布在多个套接字客户端中消息。

如果你看不到它我会再发一次。


非常感谢你的帮助。

" ; Nicholas Paldino [.NET / C#MVP]" < mv*@spam.guard.caspershouse.com写在

消息新闻:e4 ************** @ TK2MSFTNGP04.phx.gbl ...


Markgoldin,


代表什么换行符?是否存在以某种方式注入流中的实际换行符

,或者它是否表示您从服务器读取的内容中的

中断?


您从流中调用的代码是什么?你是否检查了返回值,看看你要求读取的所有字节是否实际被读取,或者你只是假设字节是

正在全部阅读?


-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com

" Markgoldin" < ma ************* @ yahoo.comWrote in message

news:u4 ************** @ TK2MSFTNGP04。 phx.gbl ...


>>我通过socket
监听器将非dontnet进程的XML数据发送到.Net。这是一个数据样本:
< VFPData>
< serverdata>
< coderun> updateFloor< / coderun>
< area> MD2< / area>
< zone> BOXING< / zone>
< status>正在运行< / status>
< job> 1000139233< / job>
< sku> 02219< / sku>
<已完成> 88< /已完成>
< / serverdata>
< / VFPData>
我的问题是,有时它会出现像这样的列表:
< VFPData>
< serverdata>
< coderun> updateFloor< / coderun>
< area> MD2< / area>
< zone> BOXING< / zone>
< status>正在运行< / status>
< job> 1000139233< / job>
< sku> 02219< / sku>
< finished> 88< / finished>
< / serverda
ta>
< / VFPData>
或者像这样:
< VFPData>
< serverdata>
< coderun> updateFloor< / coderun>
< area> MD2< / area>
< zone> BOXING< / zone>
< status>正在运行< / status>
< job> 1000139233< / job>
< sku> 02219< / sku>
< fini
shed> 92< ; / finished>
< / serverdata>
< / VFPData>
我确信发送过程会在所有时间以适当的格式发送数据。
我需要做些什么来保持XML的良好形成?

谢谢



7月30日,11:19 * am,Markgoldin < markgoldin_2 ... @ yahoo.comwrote:


我将非dontnet进程的XML数据通过套接字发送到.Net $ / b $ b听众。

这是一个数据样本:

< VFPData>

* * * *< serverdata>

* * * * * * * *< coderun> updateFloor< / coderun>

* * * * * * * *< area> MD2< / area>

* * * * * * * *< zone> BOXING< / zone>

* * * * * * * *< status>正在运行< / status>

* * * * * * * *< job> 1000139233< / job>

* * * * * * * *< sku> 02219< / sku>

* * * * * * * *<已完成> 88< /已完成>

* * * *< / serverdata>

< / VFPData>

我的问题是,有时它会出自这样的列表:

< VFPData>

* * * *< serverdata>

* * * * * * * *< coderun> updateFloor< / coderun>

* * * * * * * *< area> MD2< / area>

* * * * * * * *< zone> BOXING< / zone>

* * * * * * * *< status>正在运行< / status>

* * * * * * * *< job> 1000139233< / job>

* * * * * * * *< sku> 02219< / sku>

* * * * * * * *<已完成> 88< /已完成>

* * * *< / serverda

ta>

< / VFPData>

或类似这样:

< VFPData>

* * * *< serverdata>

* * * * * * * *< coderun> updateFloor< / coderun>

* * * * * * * *< area> MD2< / area>

* * * * * * * *< zone> BOXING< / zone>

* * * * * * * *< status>正在运行< / status>

* * * * * * * *< job> 1000139233< / job>

* * * * * * * *< sku> 02219< / sku>

* * * * * * * *< fini

shed> 92< /完成>

* * * *< / serverdata>

< / VFPData>

我确信发送过程以适当的格式发送所有

时间的数据。

我该怎么办?需要做些什么来保持XML的良好形成?


谢谢



你能发布你用来获取它的代码吗?网络流?

你在某处调用WriteLine吗?


I am sending an XML data from not dontnet process to a .Net via socket
listener.
Here is a data sample:
<VFPData>
<serverdata>
<coderun>updateFloor</coderun>
<area>MD2</area>
<zone>BOXING</zone>
<status>Running</status>
<job>1000139233</job>
<sku>02219</sku>
<finished>88</finished>
</serverdata>
</VFPData>
My problem is that sometimes it come out of a listner like this:
<VFPData>
<serverdata>
<coderun>updateFloor</coderun>
<area>MD2</area>
<zone>BOXING</zone>
<status>Running</status>
<job>1000139233</job>
<sku>02219</sku>
<finished>88</finished>
</serverda
ta>
</VFPData>
or like this:
<VFPData>
<serverdata>
<coderun>updateFloor</coderun>
<area>MD2</area>
<zone>BOXING</zone>
<status>Running</status>
<job>1000139233</job>
<sku>02219</sku>
<fini
shed>92</finished>
</serverdata>
</VFPData>
I am sure that the sending process sends data in a proper format all the
time.
What do I need to do to keep XML well formed?

Thanks

解决方案

Markgoldin,

What are the line breaks representing? Are there actual line breaks
that are being injected into the stream somehow, or does it symbolize the
breaks in what you are reading from the server?

What is the code that you are using to call from the stream? Are you
checking the return value to see that all of the bytes that you requested to
read are actually being read, or are you just assuming that the bytes are
being read completely?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Markgoldin" <ma*************@yahoo.comwrote in message
news:u4**************@TK2MSFTNGP04.phx.gbl...

>I am sending an XML data from not dontnet process to a .Net via socket
listener.
Here is a data sample:
<VFPData>
<serverdata>
<coderun>updateFloor</coderun>
<area>MD2</area>
<zone>BOXING</zone>
<status>Running</status>
<job>1000139233</job>
<sku>02219</sku>
<finished>88</finished>
</serverdata>
</VFPData>
My problem is that sometimes it come out of a listner like this:
<VFPData>
<serverdata>
<coderun>updateFloor</coderun>
<area>MD2</area>
<zone>BOXING</zone>
<status>Running</status>
<job>1000139233</job>
<sku>02219</sku>
<finished>88</finished>
</serverda
ta>
</VFPData>
or like this:
<VFPData>
<serverdata>
<coderun>updateFloor</coderun>
<area>MD2</area>
<zone>BOXING</zone>
<status>Running</status>
<job>1000139233</job>
<sku>02219</sku>
<fini
shed>92</finished>
</serverdata>
</VFPData>
I am sure that the sending process sends data in a proper format all the
time.
What do I need to do to keep XML well formed?

Thanks



<Are there actual line breaks

that are being injected into the stream somehow

Yes, I think that is what happens. I am not sending line breaks at these
positions.

<What is the code that you are using to call from the stream?
I have my code posted in "Multiple socket clients" message.
If you can''t see it I will post it again.

Thanks alot for help.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:e4**************@TK2MSFTNGP04.phx.gbl...

Markgoldin,

What are the line breaks representing? Are there actual line breaks
that are being injected into the stream somehow, or does it symbolize the
breaks in what you are reading from the server?

What is the code that you are using to call from the stream? Are you
checking the return value to see that all of the bytes that you requested
to read are actually being read, or are you just assuming that the bytes
are being read completely?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Markgoldin" <ma*************@yahoo.comwrote in message
news:u4**************@TK2MSFTNGP04.phx.gbl...

>>I am sending an XML data from not dontnet process to a .Net via socket
listener.
Here is a data sample:
<VFPData>
<serverdata>
<coderun>updateFloor</coderun>
<area>MD2</area>
<zone>BOXING</zone>
<status>Running</status>
<job>1000139233</job>
<sku>02219</sku>
<finished>88</finished>
</serverdata>
</VFPData>
My problem is that sometimes it come out of a listner like this:
<VFPData>
<serverdata>
<coderun>updateFloor</coderun>
<area>MD2</area>
<zone>BOXING</zone>
<status>Running</status>
<job>1000139233</job>
<sku>02219</sku>
<finished>88</finished>
</serverda
ta>
</VFPData>
or like this:
<VFPData>
<serverdata>
<coderun>updateFloor</coderun>
<area>MD2</area>
<zone>BOXING</zone>
<status>Running</status>
<job>1000139233</job>
<sku>02219</sku>
<fini
shed>92</finished>
</serverdata>
</VFPData>
I am sure that the sending process sends data in a proper format all the
time.
What do I need to do to keep XML well formed?

Thanks




On Jul 30, 11:19*am, "Markgoldin" <markgoldin_2...@yahoo.comwrote:

I am sending an XML data from not dontnet process to a .Net via socket
listener.
Here is a data sample:
<VFPData>
* * * * <serverdata>
* * * * * * * * <coderun>updateFloor</coderun>
* * * * * * * * <area>MD2</area>
* * * * * * * * <zone>BOXING</zone>
* * * * * * * * <status>Running</status>
* * * * * * * * <job>1000139233</job>
* * * * * * * * <sku>02219</sku>
* * * * * * * * <finished>88</finished>
* * * * </serverdata>
</VFPData>
My problem is that sometimes it come out of a listner like this:
<VFPData>
* * * * <serverdata>
* * * * * * * * <coderun>updateFloor</coderun>
* * * * * * * * <area>MD2</area>
* * * * * * * * <zone>BOXING</zone>
* * * * * * * * <status>Running</status>
* * * * * * * * <job>1000139233</job>
* * * * * * * * <sku>02219</sku>
* * * * * * * * <finished>88</finished>
* * * * </serverda
ta>
</VFPData>
or like this:
<VFPData>
* * * * <serverdata>
* * * * * * * * <coderun>updateFloor</coderun>
* * * * * * * * <area>MD2</area>
* * * * * * * * <zone>BOXING</zone>
* * * * * * * * <status>Running</status>
* * * * * * * * <job>1000139233</job>
* * * * * * * * <sku>02219</sku>
* * * * * * * * <fini
shed>92</finished>
* * * * </serverdata>
</VFPData>
I am sure that the sending process sends data in a proper format all the
time.
What do I need to do to keep XML well formed?

Thanks

can you post the code you are using to get it from the network stream?
Are you calling WriteLine somewhere?


这篇关于通过套接字发送XML数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆